Skip to content

Instantly share code, notes, and snippets.

View JeroenDeDauw's full-sized avatar
🐈
~=[,,_,,]:3

Jeroen De Dauw JeroenDeDauw

🐈
~=[,,_,,]:3
View GitHub Profile
<?php
class SharedObjectFactory {
private $container;
private $config;
public function __construct( array $config ) {
$this->container = [];
$this->config = $config;
<?php
class DonationEvents {
private $donationCreatedCallbacks = [];
private $lolCatAddedCallbacks = [];
public function onDonationCreated( callable $callback ) {
$this->donationCreatedCallbacks[] = $callback;
}
<?php
class Result {
// Static constructors
public function isRedirect(): bool {
}
<?php
interface EntityRevisionLookup {
public function getLatestRevisionId( EntityId $entityId, RevisionLookupResultHandler $resultHandler ): void;
}
// Interface version
// Great if you have anonymous classes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! /bin/bash
MW_BRANCH=$1
EXTENSION_NAME=$2
wget https://github.com/wikimedia/mediawiki/archive/$MW_BRANCH.tar.gz -nv
tar -zxf $MW_BRANCH.tar.gz
mv mediawiki-$MW_BRANCH mediawiki
@JeroenDeDauw
JeroenDeDauw / CreateItem.php
Created December 27, 2020 15:36
Maintenance script to create a Wikibase Item
<?php
namespace Wikibase\Repo\Maintenance;
use Maintenance;
use User;
use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\Lib\WikibaseSettings;
-- By Jeroen De Dauw / https://Professional.Wiki
-- License: GPL-2.0-or-later
SELECT * FROM /*_*/wb_id_counters;
REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 120), 'wikibase-item');
REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 122), 'wikibase-property');
SELECT * FROM /*_*/wb_id_counters;
{
"fields": {
"P58": {
"label": "Person – preferred name",
"description": "GND data field for the preferred name of a person or a family",
"aliases": [
"PICA+ 028A",
"PICA3 100",
"MARC 21 100"
],
$standardUser = $this->getTestUser();
$standardUser = $this->getTestUser();
$standardUser = $this->getTestUser();
$standardUser = $this->getTestUser();