public function execute() { $conn = $this->getCirrusConnection(); foreach ($conn->getAllIndexTypes() as $index) { $this->getResult()->addValue(array($index, 'page'), 'index', $conn->getIndex(wfWikiId(), $index)->getSettings()->get()); } }
/** * @param AbstractRevision $revision Revision object * @param array $row Revision row * @param array $metadata; */ public function onAfterInsert($revision, array $row, array $metadata) { global $wgRCFeeds; // No action on imported revisions if (isset($metadata['imported']) && $metadata['imported']) { return; } $action = $revision->getChangeType(); $revisionId = $revision->getRevisionId()->getAlphadecimal(); $timestamp = $revision->getRevisionId()->getTimestamp(); /** @var Workflow $workflow */ $workflow = $metadata['workflow']; $user = $revision->getUser(); if (!$this->isAllowed($revision, $action)) { return; } $title = $this->getRcTitle($workflow, $revision->getChangeType()); $attribs = array('rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_user' => $row['rev_user_id'], 'rc_user_text' => $this->usernames->get(wfWikiId(), $row['rev_user_id'], $row['rev_user_ip']), 'rc_type' => RC_FLOW, 'rc_source' => self::SRC_FLOW, 'rc_minor' => 0, 'rc_bot' => 0, 'rc_patrolled' => $user->isAllowed('autopatrol') ? 1 : 0, 'rc_old_len' => $revision->getPreviousContentLength(), 'rc_new_len' => $revision->getContentLength(), 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, 'rc_log_type' => null, 'rc_params' => serialize(array('flow-workflow-change' => array('action' => $action, 'revision_type' => get_class($revision), 'revision' => $revisionId, 'workflow' => $workflow->getId()->getAlphadecimal()))), 'rc_cur_id' => 0, 'rc_comment' => '', 'rc_timestamp' => $timestamp, 'rc_deleted' => 0); $rc = $this->rcFactory->newFromRow((object) $attribs); $rc->save(true); // Insert into db $feeds = $wgRCFeeds; // Override the IRC formatter with our own formatter foreach (array_keys($feeds) as $name) { $feeds[$name]['original_formatter'] = $feeds[$name]['formatter']; $feeds[$name]['formatter'] = $this->ircFormatter; } // pre-load the irc formatter which will be triggered via hook $this->ircFormatter->associate($rc, array('revision' => $revision) + $metadata); // run the feeds/irc/etc external notifications $rc->notifyRCFeeds($feeds); }
function wfGlobalInterwikis($prefix, &$iwData) { global $wgInterwikiCentralDB; // docs/hooks.txt says: Return true without providing an interwiki to continue interwiki search. if ($wgInterwikiCentralDB === null || $wgInterwikiCentralDB === wfWikiId()) { // No global set or this is global, nothing to add return true; } if (!Language::fetchLanguageName($prefix)) { // Check if prefix exists locally and skip foreach (Interwiki::getAllPrefixes(null) as $id => $localPrefixInfo) { if ($prefix === $localPrefixInfo['iw_prefix']) { return true; } } $dbr = wfGetDB(DB_SLAVE, array(), $wgInterwikiCentralDB); $res = $dbr->selectRow('interwiki', '*', array('iw_prefix' => $prefix), __METHOD__); if (!$res) { return true; } // Excplicitly make this an array since it's expected to be one $iwData = (array) $res; // At this point, we can safely return false because we know that we have something return false; } return true; }
protected function setUp() { global $wgFileBackends; parent::setUp(); $uniqueId = time() . '-' . mt_rand(); $tmpPrefix = wfTempDir() . '/filebackend-unittest-' . $uniqueId; if ($this->getCliArg('use-filebackend=')) { if (self::$backendToUse) { $this->singleBackend = self::$backendToUse; } else { $name = $this->getCliArg('use-filebackend='); $useConfig = array(); foreach ($wgFileBackends as $conf) { if ($conf['name'] == $name) { $useConfig = $conf; break; } } $useConfig['name'] = 'localtesting'; // swap name $useConfig['shardViaHashLevels'] = array('unittest-cont1' => array('levels' => 1, 'base' => 16, 'repeat' => 1)); $class = $useConfig['class']; self::$backendToUse = new $class($useConfig); $this->singleBackend = self::$backendToUse; } } else { $this->singleBackend = new FSFileBackend(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'wikiId' => wfWikiID() . $uniqueId, 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtesting-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtesting-cont2"))); } $this->multiBackend = new FileBackendMultiWrite(array('name' => 'localtesting', 'lockManager' => 'fsLockManager', 'parallelize' => 'implicit', 'wikiId' => wfWikiId() . $uniqueId, 'backends' => array(array('name' => 'localmultitesting1', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti1-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti1-cont2"), 'isMultiMaster' => false), array('name' => 'localmultitesting2', 'class' => 'FSFileBackend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('unittest-cont1' => "{$tmpPrefix}-localtestingmulti2-cont1", 'unittest-cont2' => "{$tmpPrefix}-localtestingmulti2-cont2"), 'isMultiMaster' => true)))); $this->filesToPrune = array(); }
public function execute() { $posFile = $this->getOption('p', 'searchUpdate.' . wfWikiId() . '.pos'); $end = $this->getOption('e', wfTimestampNow()); if ($this->hasOption('s')) { $start = $this->getOption('s'); } elseif (is_readable('searchUpdate.pos')) { # B/c to the old position file name which was hardcoded # We can safely delete the file when we're done though. $start = file_get_contents('searchUpdate.pos'); unlink('searchUpdate.pos'); } elseif (is_readable($posFile)) { $start = file_get_contents($posFile); } else { $start = wfTimestamp(TS_MW, time() - 86400); } $lockTime = $this->getOption('l', 20); $this->doUpdateSearchIndex($start, $end, $lockTime); if (is_writable(dirname(realpath($posFile)))) { $file = fopen($posFile, 'w'); if ($file !== false) { fwrite($file, $end); fclose($file); } else { $this->error("*** Couldn't write to the {$posFile}!\n"); } } else { $this->error("*** Couldn't write to the {$posFile}!\n"); } }
protected function getMocks() { $dbMock = $this->getMockBuilder('DatabaseMysql')->disableOriginalConstructor()->getMock(); $backendMock = $this->getMock('FSFileBackend', array(), array(array('name' => $this->backendName, 'wikiId' => wfWikiId()))); $wrapperMock = $this->getMock('FileBackendDBRepoWrapper', array('getDB'), array(array('backend' => $backendMock, 'repoName' => $this->repoName, 'dbHandleFactory' => null))); $wrapperMock->expects($this->any())->method('getDB')->will($this->returnValue($dbMock)); return array($dbMock, $backendMock, $wrapperMock); }
protected function setUp() { parent::setUp(); $this->filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('data' => $this->filePath))); $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => $this->backend)); $this->handler = new PNGHandler(); }
protected function setUp() { parent::setUp(); $this->checkPHPExtension('exif'); $filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('data' => $filePath))); $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => $this->backend)); $this->setMwGlobals('wgShowEXIF', true); }
public function execute() { $conn = $this->getCirrusConnection(); foreach ($conn->getAllIndexTypes() as $index) { $mapping = $conn->getPageType(wfWikiId(), $index)->getMapping(); $this->getResult()->addValue(null, $index, $mapping); $this->getResult()->addPreserveKeysList(array($index, 'page'), '_all'); } }
protected function setUp() { parent::setUp(); $this->checkPHPExtension('exif'); $this->handler = new BitmapHandler(); $filePath = __DIR__ . '/../../data/media'; $tmpDir = $this->getNewTempDirectory(); $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => array('temp-thumb' => $tmpDir, 'data' => $filePath))))); $this->setMwGlobals(array('wgShowEXIF' => true, 'wgEnableAutoRotation' => true)); }
/** * @param UserNameBatch $batch * @param array $keys key - a list of keys from storage that contain user ids, value - the wiki for the user id lookup, default to $wiki if null * @param string|null $wiki The wikiid to use when $wikiKey is null. If both are null wfWikiId() is used */ public function __construct(UserNameBatch $batch, array $keys, $wiki = null) { $this->batch = $batch; $this->keys = $keys; if ($wiki === null) { $this->wiki = wfWikiId(); } else { $this->wiki = $wiki; } }
/** * Many loaded references typically point to the same Title, cache those instead * of generating a bunch of duplicate title classes. */ public static function makeTitle($namespace, $title) { try { return Workflow::getFromTitleCache(wfWikiId(), $namespace, $title); } catch (InvalidInputException $e) { // duplicate Title::makeTitleSafe which returns null on failure, // but only for InvalidInputException return null; } }
public function execute() { global $wgGlobalUsageDatabase; $dbr = wfGetDB(DB_SLAVE); $dbw = wfGetDB(DB_MASTER, array(), $wgGlobalUsageDatabase); $gu = new GlobalUsage(wfWikiId(), $dbw); $lastPageId = intval($this->getOption('start-page', 0)); $lastIlTo = $this->getOption('start-image'); $limit = 500; $maxlag = intval($this->getOption('maxlag', 5)); do { $this->output("Querying links after (page_id, il_to) = ({$lastPageId}, {$lastIlTo})\n"); # Query all pages and any imagelinks associated with that $quotedLastIlTo = $dbr->addQuotes($lastIlTo); $res = $dbr->select(array('page', 'imagelinks', 'image'), array('page_id', 'page_namespace', 'page_title', 'il_to', 'img_name'), "(page_id = {$lastPageId} AND il_to > {$quotedLastIlTo})" . " OR page_id > {$lastPageId}", __METHOD__, array('ORDER BY' => $dbr->implicitOrderBy() ? 'page_id' : 'page_id, il_to', 'LIMIT' => $limit), array('imagelinks' => array('LEFT JOIN', 'page_id = il_from'), 'image' => array('LEFT JOIN', 'il_to = img_name'))); # Build up a tree per pages $pages = array(); $lastRow = null; foreach ($res as $row) { if (!isset($pages[$row->page_id])) { $pages[$row->page_id] = array(); } # Add the imagelinks entry to the pages array if the image # does not exist locally if (!is_null($row->il_to) && is_null($row->img_name)) { $pages[$row->page_id][$row->il_to] = $row; } $lastRow = $row; } # Insert the imagelinks data to the global table foreach ($pages as $pageId => $rows) { # Delete all original links if this page is not a continuation # of last iteration. if ($pageId != $lastPageId) { $gu->deleteLinksFromPage($pageId); } if ($rows) { $title = Title::newFromRow(reset($rows)); $images = array_keys($rows); # Since we have a pretty accurate page_id, don't specify # Title::GAID_FOR_UPDATE $gu->insertLinks($title, $images, 0); } } if ($lastRow) { # We've processed some rows in this iteration, so save # continuation variables $lastPageId = $lastRow->page_id; $lastIlTo = $lastRow->il_to; # Be nice to the database $dbw->commit(); wfWaitForSlaves($maxlag, $wgGlobalUsageDatabase); } } while (!is_null($lastRow)); }
protected function processParam($event, $param, $message, $user) { $extra = $event->getExtra(); if ($param === 'subject') { if (isset($extra['topic-title']) && $extra['topic-title']) { $this->processParamEscaped($message, trim($extra['topic-title'])); } else { $message->params(''); } } elseif ($param === 'commentText') { if (isset($extra['content']) && $extra['content']) { // @todo assumes content is html, make explicit $message->params(Utils::htmlToPlaintext($extra['content'], 200)); } else { $message->params(''); } } elseif ($param === 'post-permalink') { $anchor = $this->getPostLinkAnchor($event, $user); if ($anchor) { $message->params($anchor->getFullUrl()); } else { $message->params(''); } } elseif ($param === 'topic-permalink') { // link to individual new-topic if (isset($extra['topic-workflow'])) { $title = Workflow::getFromTitleCache(wfWikiId(), NS_TOPIC, $extra['topic-workflow']->getAlphadecimal()); } else { $title = $event->getTitle(); } $anchor = $this->getUrlGenerator()->workflowLink($title, $extra['topic-workflow']); $anchor->query['fromnotif'] = 1; $message->params($anchor->getFullUrl()); } elseif ($param === 'new-topics-permalink') { // link to board sorted by newest topics $anchor = $this->getUrlGenerator()->boardLink($event->getTitle(), 'newest'); $anchor->query['fromnotif'] = 1; $message->params($anchor->getFullUrl()); } elseif ($param == 'flow-title') { $title = $event->getTitle(); if ($title) { $formatted = $this->formatTitle($title); } else { $formatted = $this->getMessage('echo-no-title')->text(); } $message->params($formatted); } elseif ($param == 'old-subject') { $this->processParamEscaped($message, trim($extra['old-subject'])); } elseif ($param == 'new-subject') { $this->processParamEscaped($message, trim($extra['new-subject'])); } else { parent::processParam($event, $param, $message, $user); } }
private function check() { for ($pageId = $this->fromId; $pageId <= $this->toId; $pageId++) { $status = $this->checker->check($pageId); if (!$status->isOK()) { $this->error($status->getWikiText(), 1); } if (($pageId - $this->fromId) % 100 === 0) { $this->output(sprintf("[%20s]%10d/%d\n", wfWikiId(), $pageId, $this->toId)); } } }
protected function setUp() { parent::setUp(); $this->setMwGlobals('wgCapitalLinks', true); $info = array('name' => 'test', 'directory' => '/testdir', 'url' => '/testurl', 'hashLevels' => 2, 'transformVia404' => false, 'backend' => new FSFileBackend(array('name' => 'local-backend', 'wikiId' => wfWikiId(), 'containerPaths' => array('cont1' => "/testdir/local-backend/tempimages/cont1", 'cont2' => "/testdir/local-backend/tempimages/cont2")))); $this->repo_hl0 = new LocalRepo(array('hashLevels' => 0) + $info); $this->repo_hl2 = new LocalRepo(array('hashLevels' => 2) + $info); $this->repo_lc = new LocalRepo(array('initialCapital' => false) + $info); $this->file_hl0 = $this->repo_hl0->newFile('test!'); $this->file_hl2 = $this->repo_hl2->newFile('test!'); $this->file_lc = $this->repo_lc->newFile('test!'); }
public function createUser() { if ($this->wiki !== wfWikiId()) { throw new CrossWikiException('Can only retrieve same-wiki users'); } if ($this->id) { return User::newFromId($this->id); } elseif (!$this->ip) { throw new FlowException('Either $userId or $userIp must be set.'); } else { return User::newFromName($this->ip, false); } }
public function execute() { global $wgFlowCluster; $dbFactory = Container::get('db.factory'); $storage = Container::get('storage'); $rootPostLoader = Container::get('loader.root_post'); $iterator = new EchoBatchRowIterator($dbFactory->getDB(DB_SLAVE), 'flow_workflow', 'workflow_id', $this->mBatchSize); $iterator->setFetchColumns(array('workflow_id', 'workflow_type', 'workflow_last_update_timestamp')); $iterator->addConditions(array('workflow_wiki' => wfWikiId())); $updater = new EchoBatchRowUpdate($iterator, new UpdateWorkflowLastUpdateTimestampWriter($storage, $wgFlowCluster), new UpdateWorkflowLastUpdateTimestampGenerator($storage, $rootPostLoader)); $updater->setOutput(array($this, 'output')); $updater->execute(); }
/** * Output a form to allow searching for a user */ function switchForm() { global $wgScript; $knownwiki = $this->getRequest()->getVal('wpKnownWiki'); $knownwiki = $knownwiki ? $knownwiki : wfWikiId(); // Generate wiki selector $selector = new XmlSelect('wpKnownWiki', 'wpKnownWiki', $knownwiki); foreach (CentralAuthUser::getWikiList() as $wiki) { $selector->addOption($wiki); } $this->getOutput()->addModuleStyles('mediawiki.special'); $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('userrights-lookup-user')) . Xml::inputLabel(wfMsg('userrights-user-editname'), 'user', 'username', 30, $this->mTarget) . ' <br />' . Xml::label(wfMsg('centralauth-globalgrouppermissions-knownwiki'), 'wpKnownWiki') . ' ' . $selector->getHTML() . '<br />' . Xml::submitButton(wfMsg('editusergroup')) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n"); }
/** * @return FileBackend */ public function getBackend() { global $wgCaptchaFileBackend, $wgCaptchaDirectory; if ($wgCaptchaFileBackend) { return FileBackendGroup::singleton()->get($wgCaptchaFileBackend); } else { static $backend = null; if (!$backend) { $backend = new FSFileBackend(array('name' => 'captcha-backend', 'wikiId' => wfWikiId(), 'lockManager' => new NullLockManager(array()), 'containerPaths' => array('captcha-render' => $wgCaptchaDirectory), 'fileMode' => 777)); } return $backend; } }
protected function setUp() { parent::setUp(); $this->filePath = $this->getFilePath(); $containers = array('data' => $this->filePath); if ($this->createsThumbnails()) { // We need a temp directory for the thumbnails // the container is named 'temp-thumb' because it is the // thumb directory for a FSRepo named "temp". $containers['temp-thumb'] = $this->getNewTempDirectory(); } $this->backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'containerPaths' => $containers)); $this->repo = new FSRepo($this->getRepoOptions()); }
/** * Assembles the update components, runs them, and reports * on what they did */ public function doDbUpdates() { global $wgFlowCluster, $wgLang; $dbw = Container::get('db.factory')->getDB(DB_MASTER); $it = new EchoBatchRowIterator($dbw, 'flow_workflow', 'workflow_id', $this->mBatchSize); $it->setFetchColumns(array('*')); $it->addConditions(array('workflow_wiki' => wfWikiId())); $gen = new WorkflowPageIdUpdateGenerator($wgLang); $writer = new EchoBatchRowWriter($dbw, 'flow_workflow', $wgFlowCluster); $updater = new EchoBatchRowUpdate($it, $writer, $gen); $updater->execute(); $this->output($gen->report()); return true; }
protected function doJob() { $titles = array(); foreach ($this->params['titles'] as $titleArr) { list($namespace, $title) = $titleArr; $titles[] = Title::makeTitle($namespace, $title); } $flags = array(); if ($this->params['cluster']) { $flags[] = 'same-cluster'; } $otherIdx = new OtherIndexes($this->connection, $flags, wfWikiId()); $otherIdx->updateOtherIndex($titles); }
public function testIsAttached() { $lookup = new LocalIdLookup(); $user1 = User::newFromName('UTLocalIdLookup1'); $user2 = User::newFromName('DoesNotExist'); $this->assertTrue($lookup->isAttached($user1)); $this->assertFalse($lookup->isAttached($user2)); $wiki = wfWikiId(); $this->assertTrue($lookup->isAttached($user1, $wiki)); $this->assertFalse($lookup->isAttached($user2, $wiki)); $wiki = 'not-' . wfWikiId(); $this->assertFalse($lookup->isAttached($user1, $wiki)); $this->assertFalse($lookup->isAttached($user2, $wiki)); }
public function execute() { global $wgPoolCounterConf; // Make sure we don't flood the pool counter unset($wgPoolCounterConf['CirrusSearch-Search']); // Set the timeout for maintenance actions $this->setConnectionTimeout(); $this->indexType = $this->getOption('indexType'); $this->indexBaseName = $this->getOption('baseName', wfWikiId()); $indexTypes = $this->getConnection()->getAllIndexTypes(); if (!in_array($this->indexType, $indexTypes)) { $this->error('indexType option must be one of ' . implode(', ', $indexTypes), 1); } $utils = new ConfigUtils($this->getConnection()->getClient(), $this); $this->indexIdentifier = $this->getOption('indexIdentifier'); $filter = null; if ($this->hasOption('filter')) { $filter = new Elastica\Filter\Query(new Elastica\Query\QueryString($this->getOption('filter'))); } $limit = (int) $this->getOption('limit', 0); $query = new Query(); $query->setFields(array('_id', '_type', '_source')); if ($this->hasOption('sourceFields')) { $sourceFields = explode(',', $this->getOption('sourceFields')); $query->setSource(array('include' => $sourceFields)); } if ($filter) { $query->setQuery(new \Elastica\Query\Filtered(new \Elastica\Query\MatchAll(), $filter)); } $scrollOptions = array('search_type' => 'scan', 'scroll' => "15m", 'size' => $this->inputChunkSize); $index = $this->getIndex(); $result = $index->search($query, $scrollOptions); $totalDocsInIndex = $result->getResponse()->getData(); $totalDocsInIndex = $totalDocsInIndex['hits']['total']; $totalDocsToDump = $limit > 0 ? $limit : $totalDocsInIndex; $docsDumped = 0; $this->logToStderr = true; $this->output("Dumping {$totalDocsToDump} documents ({$totalDocsInIndex} in the index)\n"); $self = $this; Util::iterateOverScroll($index, $result->getResponse()->getScrollId(), '15m', function ($results) use($self, &$docsDumped, $totalDocsToDump) { foreach ($results as $result) { $document = array('_id' => $result->getId(), '_type' => $result->getType(), '_source' => $result->getSource()); $self->write($document); $docsDumped++; $self->outputProgress($docsDumped, $totalDocsToDump); } }, $limit, 5); $this->output("Dump done.\n"); }
public function isAttached(User $user, $wikiId = null) { global $wgSharedDB, $wgSharedTables, $wgLocalDatabases; // If the user has no ID, it can't be attached if (!$user->getId()) { return false; } // Easy case, we're checking locally if ($wikiId === null || $wikiId === wfWikiId()) { return true; } // Assume that shared user tables are set up as described above, if // they're being used at all. return $wgSharedDB !== null && in_array('user', $wgSharedTables, true) && in_array($wikiId, $wgLocalDatabases, true); }
/** * Create new search config for current or other wiki. * @param string $overrideWiki Interwiki link name for wiki * @param string $overrideName DB name for the wiki */ public function __construct($overrideWiki = null, $overrideName = null) { $this->interwiki = $overrideWiki; if ($overrideWiki && $overrideName) { $this->wikiId = $overrideName; if ($this->wikiId != wfWikiID()) { $this->source = new \HashConfig($this->getConfigVars($overrideName, 'wgCirrus')); $this->prefix = 'wg'; // Re-create language object $this->source->set('wgContLang', \Language::factory($this->source->get('wgLanguageCode'))); return; } } $this->source = new \GlobalVarConfig(); $this->wikiId = wfWikiId(); }
public function execute() { global $wgPoolCounterConf, $wgCirrusSearchLogElasticRequests; // Make sure we don't flood the pool counter unset($wgPoolCounterConf['CirrusSearch-Search'], $wgPoolCounterConf['CirrusSearch-PerUser']); // Don't skew the dashboards by logging these requests to // the global request log. $wgCirrusSearchLogElasticRequests = false; $this->indexBaseName = $this->getOption('baseName', wfWikiId()); $this->applyGlobals(); $callback = array($this, 'consume'); $forks = $this->getOption('fork', false); $forks = ctype_digit($forks) ? intval($forks) : 0; $controller = new StreamingForkController($forks, $callback, STDIN, STDOUT); $controller->start(); }
public function execute() { $baseName = $this->getOption('baseName', wfWikiId()); if ($this->hasOption('show-all')) { $this->show(); } elseif ($this->hasOption('update')) { $this->update($baseName); } else { $filter = new \Elastica\Filter\BoolOr(); foreach ($this->getConnection()->getAllIndexTypes() as $type) { $term = new \Elastica\Filter\Term(); $term->setTerm('_id', $this->getConnection()->getIndexName($baseName, $type)); $filter->addFilter($term); } $this->show($filter); } }
protected function setUp() { global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML; parent::setUp(); //cli tool setup $wgDjvuRenderer = $wgDjvuRenderer ? $wgDjvuRenderer : '/usr/local/bin/ddjvu'; $wgDjvuDump = $wgDjvuDump ? $wgDjvuDump : '/usr/local/bin/djvudump'; $wgDjvuToXML = $wgDjvuToXML ? $wgDjvuToXML : '/usr/local/bin/djvutoxml'; if (!$this->checkIfToolExists($wgDjvuRenderer) || !$this->checkIfToolExists($wgDjvuDump) || !$this->checkIfToolExists($wgDjvuToXML)) { $this->markTestSkipped('This test needs the installation of the ddjvu, djvutoxml and djvudump tools'); } //file repo setup $this->filePath = __DIR__ . '/../../data/media/'; $backend = new FSFileBackend(array('name' => 'localtesting', 'wikiId' => wfWikiId(), 'lockManager' => new NullLockManager(array()), 'containerPaths' => array('data' => $this->filePath))); $this->repo = new FSRepo(array('name' => 'temp', 'url' => 'http://localhost/thumbtest', 'backend' => $backend)); $this->handler = new DjVuHandler(); }