• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfWaitForSlaves函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfWaitForSlaves函数的典型用法代码示例。如果您正苦于以下问题:PHP wfWaitForSlaves函数的具体用法?PHP wfWaitForSlaves怎么用?PHP wfWaitForSlaves使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfWaitForSlaves函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 function execute()
 {
     $dbw = wfGetDB(DB_MASTER);
     $table = 'user_properties';
     $oldPropName = 'narayamDisable';
     $newPropName = 'narayamEnable';
     $this->output("Changing {$oldPropName} to {$newPropName}\n");
     $allIds = array();
     while (true) {
         $dbw->begin();
         $res = $dbw->select($table, array('up_user'), array('up_property' => $oldPropName, 'up_value' => 1), __METHOD__, array('LIMIT' => $this->mBatchSize, 'FOR UPDATE'));
         if (!$res->numRows()) {
             break;
         }
         $ids = array();
         foreach ($res as $row) {
             $ids[] = $row->up_user;
         }
         $dbw->update($table, array('up_property' => $newPropName, 'up_value' => 0), array('up_property' => $oldPropName, 'up_user' => $ids), __METHOD__);
         $dbw->commit();
         foreach ($ids as $id) {
             $user = User::newFromID($id);
             if ($user) {
                 $user->invalidateCache();
             }
         }
         wfWaitForSlaves(10);
     }
     $this->output("Old preference {$oldPropName} was migrated to {$newPropName}\n");
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:FixNarayamDisablePref.php


示例2: execute

 public function execute()
 {
     global $wgEchoCluster;
     $this->output("Started processing... \n");
     $startUserId = 0;
     $count = $this->batchSize;
     while ($count === $this->batchSize) {
         $count = 0;
         $res = MWEchoEmailBatch::getUsersToNotify($startUserId, $this->batchSize);
         $updated = false;
         foreach ($res as $row) {
             $userId = intval($row->eeb_user_id);
             if ($userId && $userId > $startUserId) {
                 $emailBatch = MWEchoEmailBatch::newFromUserId($userId);
                 if ($emailBatch) {
                     $this->output("processing user_Id " . $userId . " \n");
                     $emailBatch->process();
                 }
                 $startUserId = $userId;
                 $updated = true;
             }
             $count++;
         }
         wfWaitForSlaves(false, false, $wgEchoCluster);
         // This is required since we are updating user properties in main wikidb
         wfWaitForSlaves();
         // double check to make sure that the id is updated
         if (!$updated) {
             break;
         }
     }
     $this->output("Completed \n");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:33,代码来源:processEchoEmailBatch.php


示例3: execute

	public function execute() {
		$userName = 'The Thing That Should Not Be'; // <- targer username

		$user = new CentralAuthUser( $userName );
		if ( !$user->exists() ) {
			echo "Cannot unsuppress non-existent user {$userName}!\n";
			exit( 0 );
		}
		$userName = $user->getName(); // sanity
		$wikis = $user->listAttached(); // wikis with attached accounts
		foreach ( $wikis as $wiki ) {
			$lb = wfGetLB( $wiki );
			$dbw = $lb->getConnection( DB_MASTER, array(), $wiki );
			# Get local ID like $user->localUserData( $wiki ) does
			$localUserId = $dbw->selectField( 'user', 'user_id',
				array( 'user_name' => $userName ), __METHOD__ );

			$delUserBit = Revision::DELETED_USER;
			$hiddenCount = $dbw->selectField( 'revision', 'COUNT(*)',
				array( 'rev_user' => $localUserId, "rev_deleted & $delUserBit != 0" ), __METHOD__ );
			echo "$hiddenCount edits have the username hidden on \"$wiki\"\n";
			# Unsuppress username on edits
			if ( $hiddenCount > 0 ) {
				echo "Unsuppressed edits of attached account (local id $localUserId) on \"$wiki\"...";
				IPBlockForm::unsuppressUserName( $userName, $localUserId, $dbw );
				echo "done!\n\n";
			}
			$lb->reuseConnection( $dbw ); // not really needed
			# Don't lag too bad
			wfWaitForSlaves( 5 );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:32,代码来源:unsuppressCrossWiki.php


示例4: execute

 public function execute()
 {
     $db = wfGetDB(DB_MASTER);
     $start = $db->selectField('logging', 'MIN(log_id)', false, __METHOD__);
     if (!$start) {
         $this->output("Nothing to do.\n");
         return true;
     }
     $end = $db->selectField('logging', 'MAX(log_id)', false, __METHOD__);
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     while ($blockEnd <= $end) {
         $this->output("...doing log_id from {$blockStart} to {$blockEnd}\n");
         $cond = "log_id BETWEEN {$blockStart} AND {$blockEnd} AND log_user = user_id";
         $res = $db->select(array('logging', 'user'), array('log_id', 'user_name'), $cond, __METHOD__);
         $db->begin();
         foreach ($res as $row) {
             $db->update('logging', array('log_user_text' => $row->user_name), array('log_id' => $row->log_id), __METHOD__);
         }
         $db->commit();
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
         wfWaitForSlaves(5);
     }
     if ($db->insert('updatelog', array('ul_key' => 'populate log_usertext'), __METHOD__, 'IGNORE')) {
         $this->output("log_usertext population complete.\n");
         return true;
     } else {
         $this->output("Could not insert log_usertext population row.\n");
         return false;
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:34,代码来源:populateLogUsertext.php


示例5: doDBUpdates

 protected function doDBUpdates()
 {
     $db = $this->getDB(DB_MASTER);
     $start = $db->selectField('logging', 'MIN(log_id)', false, __METHOD__);
     if (!$start) {
         $this->output("Nothing to do.\n");
         return true;
     }
     $end = $db->selectField('logging', 'MAX(log_id)', false, __METHOD__);
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     while ($blockEnd <= $end) {
         $this->output("...doing log_id from {$blockStart} to {$blockEnd}\n");
         $cond = "log_id BETWEEN {$blockStart} AND {$blockEnd} AND log_user = user_id";
         $res = $db->select(array('logging', 'user'), array('log_id', 'user_name'), $cond, __METHOD__);
         $db->begin(__METHOD__);
         foreach ($res as $row) {
             $db->update('logging', array('log_user_text' => $row->user_name), array('log_id' => $row->log_id), __METHOD__);
         }
         $db->commit(__METHOD__);
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
         wfWaitForSlaves();
     }
     $this->output("Done populating log_user_text field.\n");
     return true;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:29,代码来源:populateLogUsertext.php


示例6: prune

 protected function prune($table, $ts_column, $maxAge)
 {
     $dbw = wfGetDB(DB_MASTER);
     $expiredCond = "{$ts_column} < " . $dbw->addQuotes($dbw->timestamp(time() - $maxAge));
     $count = 0;
     while (true) {
         // Get the first $this->mBatchSize (or less) items
         $res = $dbw->select($table, $ts_column, $expiredCond, __METHOD__, array('ORDER BY' => "{$ts_column} ASC", 'LIMIT' => $this->mBatchSize));
         if (!$res->numRows()) {
             break;
             // all cleared
         }
         // Record the start and end timestamp for the set
         $blockStart = $dbw->addQuotes($res->fetchObject()->{$ts_column});
         $res->seek($res->numRows() - 1);
         $blockEnd = $dbw->addQuotes($res->fetchObject()->{$ts_column});
         $res->free();
         // Do the actual delete...
         $dbw->begin();
         $dbw->delete($table, array("{$ts_column} BETWEEN {$blockStart} AND {$blockEnd}"), __METHOD__);
         $count += $dbw->affectedRows();
         $dbw->commit();
         wfWaitForSlaves();
     }
     return $count;
 }
开发者ID:yusufchang,项目名称:app,代码行数:26,代码来源:purgeOldData.php


示例7: execute

 public function execute()
 {
     $dbw = wfGetDB(DB_MASTER);
     $rl = new ResourceLoader(ConfigFactory::getDefaultInstance()->makeConfig('main'));
     $moduleNames = $rl->getModuleNames();
     $moduleList = implode(', ', array_map(array($dbw, 'addQuotes'), $moduleNames));
     $limit = max(1, intval($this->getOption('batchsize', 500)));
     $this->output("Cleaning up module_deps table...\n");
     $i = 1;
     $modDeps = $dbw->tableName('module_deps');
     do {
         // $dbw->delete() doesn't support LIMIT :(
         $where = $moduleList ? "md_module NOT IN ({$moduleList})" : '1=1';
         $dbw->query("DELETE FROM {$modDeps} WHERE {$where} LIMIT {$limit}", __METHOD__);
         $numRows = $dbw->affectedRows();
         $this->output("Batch {$i}: {$numRows} rows\n");
         $i++;
         wfWaitForSlaves();
     } while ($numRows > 0);
     $this->output("done\n");
     $this->output("Cleaning up msg_resource table...\n");
     $i = 1;
     $mrRes = $dbw->tableName('msg_resource');
     do {
         $where = $moduleList ? "mr_resource NOT IN ({$moduleList})" : '1=1';
         $dbw->query("DELETE FROM {$mrRes} WHERE {$where} LIMIT {$limit}", __METHOD__);
         $numRows = $dbw->affectedRows();
         $this->output("Batch {$i}: {$numRows} rows\n");
         $i++;
         wfWaitForSlaves();
     } while ($numRows > 0);
     $this->output("done\n");
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:33,代码来源:cleanupRemovedModules.php


示例8: processSynonym

	public function processSynonym( $synonym ) {
		$dbr = wfGetDB( DB_SLAVE );
		$pCount = 0;
		$vCount = 0;
		$this->output( "Fixing pages with template links to $synonym ...\n" );
		while ( true ) {
			$res = $dbr->select( 'templatelinks', array( 'tl_title', 'tl_from' ),
				array(
					'tl_namespace' => NS_TEMPLATE,
					'tl_title ' . $dbr->buildLike( $synonym, $dbr->anyString() )
				), __METHOD__,
				array( 'ORDER BY' => array( 'tl_title', 'tl_from' ), 'LIMIT' => $this->batchsize )
			);
			if ( $dbr->numRows( $res ) == 0 ) {
				// No more rows, we're done
				break;
			}

			$processed = array();
			foreach ( $res as $row ) {
				$vCount++;
				if ( isset( $processed[$row->tl_from] ) ) {
					// We've already processed this page, skip it
					continue;
				}
				RefreshLinks::fixLinksFromArticle( $row->tl_from );
				$processed[$row->tl_from] = true;
				$pCount++;
			}
			$this->output( "{$pCount}/{$vCount} pages processed\n" );
			wfWaitForSlaves();
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:33,代码来源:cleanupBug31576.php


示例9: doImport

 /**
  * @param $fileHandle
  * @param DatabaseBase $db
  * @param ImportContext $importContext
  * @throws UnexpectedValueException
  */
 private function doImport($fileHandle, DatabaseBase $db, ImportContext $importContext)
 {
     $accumulator = array();
     $batchSize = $importContext->getBatchSize();
     $i = 0;
     $header = fgetcsv($fileHandle, 0, $importContext->getCsvDelimiter());
     //this is to get the csv-header
     $expectedHeader = array('pid1', 'qid1', 'pid2', 'count', 'probability', 'context');
     if ($header != $expectedHeader) {
         throw new UnexpectedValueException("provided csv-file does not match the expected format:\n" . join(',', $expectedHeader));
     }
     while (true) {
         $data = fgetcsv($fileHandle, 0, $importContext->getCsvDelimiter());
         if ($data == false || ++$i % $batchSize == 0) {
             $db->commit(__METHOD__, 'flush');
             wfWaitForSlaves();
             $db->insert($importContext->getTargetTableName(), $accumulator);
             if (!$importContext->isQuiet()) {
                 print "{$i} rows inserted\n";
             }
             $accumulator = array();
             if ($data == false) {
                 break;
             }
         }
         $qid1 = is_numeric($data[1]) ? $data[1] : 0;
         $accumulator[] = array('pid1' => $data[0], 'qid1' => $qid1, 'pid2' => $data[2], 'count' => $data[3], 'probability' => $data[4], 'context' => $data[5]);
     }
 }
开发者ID:siebrand,项目名称:PropertySuggester,代码行数:35,代码来源:BasicImporter.php


示例10: doDBUpdates

 public function doDBUpdates()
 {
     $force = $this->getOption('force');
     $db = $this->getDB(DB_MASTER);
     $this->output("Updating *_from_namespace fields in links tables.\n");
     $start = $this->getOption('lastUpdatedId');
     if (!$start) {
         $start = $db->selectField('page', 'MIN(page_id)', false, __METHOD__);
     }
     if (!$start) {
         $this->output("Nothing to do.");
         return false;
     }
     $end = $db->selectField('page', 'MAX(page_id)', false, __METHOD__);
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     while ($blockEnd <= $end) {
         $this->output("...doing page_id from {$blockStart} to {$blockEnd}\n");
         $cond = "page_id BETWEEN {$blockStart} AND {$blockEnd}";
         $res = $db->select('page', array('page_id', 'page_namespace'), $cond, __METHOD__);
         foreach ($res as $row) {
             $db->update('pagelinks', array('pl_from_namespace' => $row->page_namespace), array('pl_from' => $row->page_id), __METHOD__);
             $db->update('templatelinks', array('tl_from_namespace' => $row->page_namespace), array('tl_from' => $row->page_id), __METHOD__);
             $db->update('imagelinks', array('il_from_namespace' => $row->page_namespace), array('il_from' => $row->page_id), __METHOD__);
         }
         $blockStart += $this->mBatchSize - 1;
         $blockEnd += $this->mBatchSize - 1;
         wfWaitForSlaves();
     }
     return true;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:33,代码来源:populateBacklinkNamespace.php


示例11: execute

 public function execute()
 {
     $count = 0;
     $oldGroup = $this->getArg(0);
     $newGroup = $this->getArg(1);
     $dbw = wfGetDB(DB_MASTER);
     $start = $dbw->selectField('user_groups', 'MIN(ug_user)', array('ug_group' => $oldGroup), __FUNCTION__);
     $end = $dbw->selectField('user_groups', 'MAX(ug_user)', array('ug_group' => $oldGroup), __FUNCTION__);
     if ($start === null) {
         $this->error("Nothing to do - no users in the '{$oldGroup}' group", true);
     }
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     // Migrate users over in batches...
     while ($blockEnd <= $end) {
         $this->output("Doing users {$blockStart} to {$blockEnd}\n");
         $dbw->begin();
         $dbw->update('user_groups', array('ug_group' => $newGroup), array('ug_group' => $oldGroup, "ug_user BETWEEN {$blockStart} AND {$blockEnd}"));
         $count += $dbw->affectedRows();
         $dbw->commit();
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
         wfWaitForSlaves(5);
     }
     $this->output("Done! {$count} user(s) in group '{$oldGroup}' are now in '{$newGroup}' instead.\n");
 }
开发者ID:rocLv,项目名称:conference,代码行数:28,代码来源:migrateUserGroup.php


示例12: moveToExternal

function moveToExternal($cluster, $maxID)
{
    $fname = 'moveToExternal';
    $dbw =& wfGetDB(DB_MASTER);
    print "Moving {$maxID} text rows to external storage\n";
    $ext = new ExternalStoreDB();
    for ($id = 1; $id <= $maxID; $id++) {
        if (!($id % REPORTING_INTERVAL)) {
            print "{$id}\n";
            wfWaitForSlaves(5);
        }
        $row = $dbw->selectRow('text', array('old_flags', 'old_text'), array('old_id' => $id, "old_flags NOT LIKE '%external%'"), $fname);
        if (!$row) {
            # Non-existent or already done
            continue;
        }
        # Resolve stubs
        $flags = explode(',', $row->old_flags);
        if (in_array('object', $flags) && substr($row->old_text, 0, strlen(STUB_HEADER)) === STUB_HEADER) {
            resolveStub($id, $row->old_text, $row->old_flags);
            continue;
        }
        $url = $ext->store($cluster, $row->old_text);
        if (!$url) {
            print "Error writing to external storage\n";
            exit;
        }
        if ($row->old_flags === '') {
            $flags = 'external';
        } else {
            $flags = "{$row->old_flags},external";
        }
        $dbw->update('text', array('old_flags' => $flags, 'old_text' => $url), array('old_id' => $id), $fname);
    }
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:35,代码来源:moveToExternal.php


示例13: execute

 public function execute()
 {
     $this->commit = $this->hasOption('commit');
     $dbr = $this->getDB(DB_SLAVE);
     $dbw = $this->getDB(DB_MASTER);
     $lastId = 0;
     do {
         $rows = $dbr->select('user', array('user_id', 'user_email'), array('user_id > ' . $dbr->addQuotes($lastId), 'user_email != ""', 'user_email_authenticated IS NULL'), __METHOD__, array('LIMIT' => $this->mBatchSize));
         $count = $rows->numRows();
         $badIds = array();
         foreach ($rows as $row) {
             if (!Sanitizer::validateEmail(trim($row->user_email))) {
                 $this->output("Found bad email: {$row->user_email} for user #{$row->user_id}\n");
                 $badIds[] = $row->user_id;
             }
             if ($row->user_id > $lastId) {
                 $lastId = $row->user_id;
             }
         }
         if ($badIds) {
             $badCount = count($badIds);
             if ($this->commit) {
                 $this->output("Removing {$badCount} emails from the database.\n");
                 $dbw->update('user', array('user_email' => ''), array('user_id' => $badIds), __METHOD__);
                 foreach ($badIds as $badId) {
                     User::newFromId($badId)->invalidateCache();
                 }
                 wfWaitForSlaves();
             } else {
                 $this->output("Would have removed {$badCount} emails from the database.\n");
             }
         }
     } while ($count !== 0);
     $this->output("Done.\n");
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:35,代码来源:removeInvalidEmails.php


示例14: doDBUpdates

 protected function doDBUpdates()
 {
     $dbw = $this->getDB(DB_MASTER);
     if (!$dbw->fieldExists('recentchanges', 'rc_source')) {
         $this->error('rc_source field in recentchanges table does not exist.');
     }
     $start = $dbw->selectField('recentchanges', 'MIN(rc_id)', false, __METHOD__);
     if (!$start) {
         $this->output("Nothing to do.\n");
         return true;
     }
     $end = $dbw->selectField('recentchanges', 'MAX(rc_id)', false, __METHOD__);
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     $updatedValues = $this->buildUpdateCondition($dbw);
     while ($blockEnd <= $end) {
         $cond = "rc_id BETWEEN {$blockStart} AND {$blockEnd}";
         $dbw->update('recentchanges', [$updatedValues], ["rc_source = ''", "rc_id BETWEEN {$blockStart} AND {$blockEnd}"], __METHOD__);
         $this->output(".");
         wfWaitForSlaves();
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
     }
     $this->output("\nDone.\n");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:26,代码来源:populateRecentChangesSource.php


示例15: execute

 public function execute()
 {
     $user = 'MediaWiki default';
     $reason = 'No longer required';
     $this->output("Checking existence of old default messages...");
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select(array('page', 'revision'), array('page_namespace', 'page_title'), array('page_namespace' => NS_MEDIAWIKI, 'page_latest=rev_id', 'rev_user_text' => 'MediaWiki default'));
     if ($dbr->numRows($res) == 0) {
         # No more messages left
         $this->output("done.\n");
         return;
     }
     # Deletions will be made by $user temporarly added to the bot group
     # in order to hide it in RecentChanges.
     global $wgUser;
     $wgUser = User::newFromName($user);
     $wgUser->addGroup('bot');
     # Handle deletion
     $this->output("\n...deleting old default messages (this may take a long time!)...", 'msg');
     $dbw = wfGetDB(DB_MASTER);
     foreach ($res as $row) {
         if (function_exists('wfWaitForSlaves')) {
             wfWaitForSlaves(5);
         }
         $dbw->ping();
         $title = Title::makeTitle($row->page_namespace, $row->page_title);
         $article = new Article($title);
         $dbw->begin();
         $article->doDeleteArticle($reason);
         $dbw->commit();
     }
     $this->output('done!', 'msg');
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:33,代码来源:deleteDefaultMessages.php


示例16: execute

 public function execute()
 {
     global $wgUser;
     $this->output("Checking existence of old default messages...");
     $dbr = $this->getDB(DB_REPLICA);
     $res = $dbr->select(['page', 'revision'], ['page_namespace', 'page_title'], ['page_namespace' => NS_MEDIAWIKI, 'page_latest=rev_id', 'rev_user_text' => 'MediaWiki default']);
     if ($dbr->numRows($res) == 0) {
         # No more messages left
         $this->output("done.\n");
         return;
     }
     # Deletions will be made by $user temporarly added to the bot group
     # in order to hide it in RecentChanges.
     $user = User::newFromName('MediaWiki default');
     if (!$user) {
         $this->error("Invalid username", true);
     }
     $user->addGroup('bot');
     $wgUser = $user;
     # Handle deletion
     $this->output("\n...deleting old default messages (this may take a long time!)...", 'msg');
     $dbw = $this->getDB(DB_MASTER);
     foreach ($res as $row) {
         wfWaitForSlaves();
         $dbw->ping();
         $title = Title::makeTitle($row->page_namespace, $row->page_title);
         $page = WikiPage::factory($title);
         $error = '';
         // Passed by ref
         // FIXME: Deletion failures should be reported, not silently ignored.
         $page->doDeleteArticle('No longer required', false, 0, true, $error, $user);
     }
     $this->output("done!\n", 'msg');
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:34,代码来源:deleteDefaultMessages.php


示例17: execute

 public function execute()
 {
     if (!$this->invalidEventType) {
         $this->output("There is nothing to process\n");
         return;
     }
     global $wgEchoCluster;
     $dbw = MWEchoDbFactory::getDB(DB_MASTER);
     $dbr = MWEchoDbFactory::getDB(DB_SLAVE);
     $count = $this->batchSize;
     while ($count == $this->batchSize) {
         $res = $dbr->select(array('echo_event'), array('event_id'), array('event_type' => $this->invalidEventType), __METHOD__, array('LIMIT' => $this->batchSize));
         $event = array();
         $count = 0;
         foreach ($res as $row) {
             if (!in_array($row->event_id, $event)) {
                 $event[] = $row->event_id;
             }
             $count++;
         }
         if ($event) {
             $dbw->begin();
             $dbw->delete('echo_event', array('event_id' => $event), __METHOD__);
             $dbw->delete('echo_notification', array('notification_event' => $event), __METHOD__);
             $dbw->commit();
             $this->output("processing " . count($event) . " invalid events\n");
             wfWaitForSlaves(false, false, $wgEchoCluster);
         }
         // Cleanup is not necessary for
         // 1. echo_email_batch, invalid notification is removed during the cron
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:32,代码来源:removeInvalidNotification.php


示例18: execute

 public function execute()
 {
     $dbw = $this->getDB(DB_MASTER);
     $lastId = 0;
     do {
         // Get user IDs which need fixing
         $res = $dbw->select('user', 'user_id', array('user_id > ' . $dbw->addQuotes($lastId), 'user_registration IS NULL'), __METHOD__, array('LIMIT' => $this->mBatchSize, 'ORDER BY' => 'user_id'));
         foreach ($res as $row) {
             $id = $row->user_id;
             $lastId = $id;
             // Get first edit time
             $timestamp = $dbw->selectField('revision', 'MIN(rev_timestamp)', array('rev_user' => $id), __METHOD__);
             // Update
             if ($timestamp !== null) {
                 $dbw->update('user', array('user_registration' => $timestamp), array('user_id' => $id), __METHOD__);
                 $user = User::newFromId($id);
                 $user->invalidateCache();
                 $this->output("Set registration for #{$id} to {$timestamp}\n");
             } else {
                 $this->output("Could not find registration for #{$id} NULL\n");
             }
         }
         $this->output("Waiting for slaves...");
         wfWaitForSlaves();
         $this->output(" done.\n");
     } while ($res->numRows() >= $this->mBatchSize);
 }
开发者ID:kolzchut,项目名称:mediawiki-molsa-new,代码行数:27,代码来源:fixUserRegistration.php


示例19: execute

 public function execute()
 {
     $this->nullsOnly = $this->getOption('nulls');
     if (!$this->getOption('nowarn')) {
         if ($this->nullsOnly) {
             $this->output("The script is about to reset the user_token " . "for USERS WITH NULL TOKENS in the database.\n");
         } else {
             $this->output("The script is about to reset the user_token for ALL USERS in the database.\n");
             $this->output("This may log some of them out and is not necessary unless you believe your\n");
             $this->output("user table has been compromised.\n");
         }
         $this->output("\n");
         $this->output("Abort with control-c in the next five seconds " . "(skip this countdown with --nowarn) ... ");
         wfCountDown(5);
     }
     // We list user by user_id from one of the slave database
     $dbr = $this->getDB(DB_SLAVE);
     $where = array();
     if ($this->nullsOnly) {
         // Have to build this by hand, because \ is escaped in helper functions
         $where = array('user_token = \'' . str_repeat('\\0', 32) . '\'');
     }
     $maxid = $dbr->selectField('user', 'MAX(user_id)', array(), __METHOD__);
     $min = 0;
     $max = $this->mBatchSize;
     do {
         $result = $dbr->select('user', array('user_id'), array_merge($where, array('user_id > ' . $dbr->addQuotes($min), 'user_id <= ' . $dbr->addQuotes($max))), __METHOD__);
         foreach ($result as $user) {
             $this->updateUser($user->user_id);
         }
         $min = $max;
         $max = $min + $this->mBatchSize;
         wfWaitForSlaves();
     } while ($min <= $maxid);
 }
开发者ID:kolzchut,项目名称:mediawiki-molsa-new,代码行数:35,代码来源:resetUserTokens.php


示例20: execute

 function execute()
 {
     $dbw = wfGetDB(DB_MASTER);
     $batchSize = 100;
     $total = 0;
     $lastUserID = 0;
     while (true) {
         $res = $dbw->select('user_properties', array('up_user'), array('up_property' => 'vector-noexperiments', "up_user > {$lastUserID}"), __METHOD__, array('LIMIT' => $batchSize));
         if (!$res->numRows()) {
             $dbw->commit();
             break;
         }
         $total += $res->numRows();
         $ids = array();
         foreach ($res as $row) {
             $ids[] = $row->up_user;
         }
         $lastUserID = max($ids);
         foreach ($ids as $id) {
             $user = User::newFromId($id);
             if (!$user->isLoggedIn()) {
                 continue;
             }
             $user->setOption($this->getOption('pref'), $this->getOption('value'));
             $user->saveSettings();
         }
         echo "{$total}\n";
         wfWaitForSlaves();
         // Must be wfWaitForSlaves_masterPos(); on 1.17wmf1
     }
     echo "Done\n";
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:switchExperimentPrefs.php



注:本文中的wfWaitForSlaves函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfWarn函数代码示例发布时间:2022-05-23
下一篇:
PHP wfViewPrevNext函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap