Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EntityDataSerializationService-profile-production
Creating the object and make it do EntityDataSerializationService::initFormats by calling EntityDataSerializationService::getSupportedMimeTypes:
hoo@mw1017:~$ sudo -u www-data mwscript eval.php --wiki wikidatawiki
> function getSerializationService() { $wikibaseRepo = Wikibase\Repo\WikibaseRepo::getDefaultInstance(); $entityRevisionLookup = $wikibaseRepo->getEntityRevisionLookup(); $titleLookup = $wikibaseRepo->getEntityTitleLookup(); $entityIdParser = $wikibaseRepo->getEntityIdParser(); $serializationOptions = new Wikibase\Lib\Serializers\SerializationOptions(); $serializerFactory = new Wikibase\Lib\Serializers\SerializerFactory( $serializationOptions, $wikibaseRepo->getPropertyDataTypeLookup(), $wikibaseRepo->getEntityFactory() ); $serializationService = new Wikibase\Repo\LinkedData\EntityDataSerializationService( $wikibaseRepo->getSettings()->getSetting( 'conceptBaseUri' ), 'someString/', $wikibaseRepo->getStore()->getEntityLookup(), $titleLookup, $serializerFactory, $wikibaseRepo->getPropertyDataTypeLookup(), $wikibaseRepo->getSiteStore()->getSites() ); return $serializationService; }
> $service = getSerializationService(); $time = microtime( true ); $service->getSupportedMimeTypes(); echo microtime( true ) - $time;
0.018081903457642
> $service = getSerializationService(); $time = microtime( true ); $service->getSupportedMimeTypes(); echo microtime( true ) - $time;
0.0010039806365967
> $service = getSerializationService(); $time = microtime( true ); $service->getSupportedMimeTypes(); echo microtime( true ) - $time;
0.00097799301147461
> $service = getSerializationService(); $time = microtime( true ); $service->getSupportedMimeTypes(); echo microtime( true ) - $time;
0.0009920597076416
> $service = getSerializationService(); $time = microtime( true ); $service->getSupportedMimeTypes(); echo microtime( true ) - $time;
0.001060962677002
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment