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

PHP wfShellWikiCmd函数代码示例

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

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



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

示例1: execute

 public function execute()
 {
     global $IP, $wgLocalDatabases, $wgUser;
     $username = wfMessage('spambot_username')->text();
     $wgUser = User::newFromName($username);
     if (!$wgUser) {
         $this->error("Invalid username specified in 'spambot_username' message: {$username}", true);
     }
     // Create the user if necessary
     if (!$wgUser->getId()) {
         $wgUser->addToDatabase();
     }
     $spec = $this->getArg();
     $like = LinkFilter::makeLikeArray($spec);
     if (!$like) {
         $this->error("Not a valid hostname specification: {$spec}", true);
     }
     if ($this->hasOption('all')) {
         // Clean up spam on all wikis
         $this->output("Finding spam on " . count($wgLocalDatabases) . " wikis\n");
         $found = false;
         foreach ($wgLocalDatabases as $wikiID) {
             $dbr = wfGetDB(DB_SLAVE, array(), $wikiID);
             $count = $dbr->selectField('externallinks', 'COUNT(*)', array('el_index' . $dbr->buildLike($like)), __METHOD__);
             if ($count) {
                 $found = true;
                 $cmd = wfShellWikiCmd("{$IP}/maintenance/cleanupSpam.php", array('--wiki', $wikiID, $spec));
                 passthru("{$cmd} | sed 's/^/{$wikiID}:  /'");
             }
         }
         if ($found) {
             $this->output("All done\n");
         } else {
             $this->output("None found\n");
         }
     } else {
         // Clean up spam on this wiki
         $dbr = wfGetDB(DB_SLAVE);
         $res = $dbr->select('externallinks', array('DISTINCT el_from'), array('el_index' . $dbr->buildLike($like)), __METHOD__);
         $count = $dbr->numRows($res);
         $this->output("Found {$count} articles containing {$spec}\n");
         foreach ($res as $row) {
             $this->cleanupArticle($row->el_from, $spec);
         }
         if ($count) {
             $this->output("Done\n");
         }
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:49,代码来源:cleanupSpam.php


示例2: init

 protected function init()
 {
     global $IP;
     $this->doxygen = $this->getOption('doxygen', 'doxygen');
     $this->mwVersion = $this->getOption('version', 'master');
     $this->input = '';
     $inputs = explode(',', $this->getOption('file', ''));
     foreach ($inputs as $input) {
         # Doxygen inputs are space separted and double quoted
         $this->input .= " \"{$IP}/{$input}\"";
     }
     $this->output = $this->getOption('output', "{$IP}/docs");
     $this->inputFilter = wfShellWikiCmd($IP . '/maintenance/mwdoc-filter.php');
     $this->template = $IP . '/maintenance/Doxyfile';
     $this->excludes = array('vendor', 'node_modules', 'images', 'static');
     $this->excludePatterns = array();
     if ($this->hasOption('no-extensions')) {
         $this->excludePatterns[] = 'extensions';
     }
     $this->doDot = `which dot`;
     $this->doMan = $this->hasOption('generate-man');
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:22,代码来源:mwdocgen.php


示例3: doJobs

 /**
  * Do a job from the job queue
  */
 private function doJobs()
 {
     global $wgJobRunRate, $wgPhpCli, $IP;
     if ($wgJobRunRate <= 0 || wfReadOnly()) {
         return;
     }
     if ($wgJobRunRate < 1) {
         $max = mt_getrandmax();
         if (mt_rand(0, $max) > $max * $wgJobRunRate) {
             return;
             // the higher $wgJobRunRate, the less likely we return here
         }
         $n = 1;
     } else {
         $n = intval($wgJobRunRate);
     }
     if (!wfShellExecDisabled() && is_executable($wgPhpCli)) {
         // Start a background process to run some of the jobs.
         // This will be asynchronous on *nix though not on Windows.
         wfProfileIn(__METHOD__ . '-exec');
         $retVal = 1;
         $cmd = wfShellWikiCmd("{$IP}/maintenance/runJobs.php", array('--maxjobs', $n));
         wfShellExec("{$cmd} &", $retVal);
         wfProfileOut(__METHOD__ . '-exec');
     } else {
         // Fallback to running the jobs here while the user waits
         $group = JobQueueGroup::singleton();
         do {
             $job = $group->pop(JobQueueGroup::USE_CACHE);
             // job from any queue
             if ($job) {
                 $output = $job->toString() . "\n";
                 $t = -microtime(true);
                 wfProfileIn(__METHOD__ . '-' . get_class($job));
                 $success = $job->run();
                 wfProfileOut(__METHOD__ . '-' . get_class($job));
                 $group->ack($job);
                 // done
                 $t += microtime(true);
                 $t = round($t * 1000);
                 if ($success === false) {
                     $output .= "Error: " . $job->getLastError() . ", Time: {$t} ms\n";
                 } else {
                     $output .= "Success, Time: {$t} ms\n";
                 }
                 wfDebugLog('jobqueue', $output);
             }
         } while (--$n && $job);
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:53,代码来源:Wiki.php


示例4: testWfShellWikiCmd

 /**
  * @dataProvider provideWfShellWikiCmdList
  * @covers ::wfShellWikiCmd
  */
 public function testWfShellWikiCmd($script, $parameters, $options, $expected, $description)
 {
     if (wfIsWindows()) {
         // Approximation that's good enough for our purposes just now
         $expected = str_replace("'", '"', $expected);
     }
     $actual = wfShellWikiCmd($script, $parameters, $options);
     $this->assertEquals($expected, $actual, $description);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:13,代码来源:GlobalTest.php


示例5: getConfig

 /**
  * Get the resolved (post-setup) configuration of a potentially foreign wiki.
  * For foreign wikis, this is expensive, and only works if maintenance
  * scripts are setup to handle the --wiki parameter such as in wiki farms.
  *
  * @param string $wiki
  * @param array|string $settings A setting name or array of setting names
  * @return mixed|mixed[] Array if $settings is an array, otherwise the value
  * @throws MWException
  * @since 1.21
  */
 public function getConfig($wiki, $settings)
 {
     global $IP;
     $multi = is_array($settings);
     $settings = (array) $settings;
     if ($wiki === wfWikiID()) {
         // $wiki is this wiki
         $res = [];
         foreach ($settings as $name) {
             if (!preg_match('/^wg[A-Z]/', $name)) {
                 throw new MWException("Variable '{$name}' does start with 'wg'.");
             } elseif (!isset($GLOBALS[$name])) {
                 throw new MWException("Variable '{$name}' is not set.");
             }
             $res[$name] = $GLOBALS[$name];
         }
     } else {
         // $wiki is a foreign wiki
         if (isset($this->cfgCache[$wiki])) {
             $res = array_intersect_key($this->cfgCache[$wiki], array_flip($settings));
             if (count($res) == count($settings)) {
                 return $multi ? $res : current($res);
                 // cache hit
             }
         } elseif (!in_array($wiki, $this->wikis)) {
             throw new MWException("No such wiki '{$wiki}'.");
         } else {
             $this->cfgCache[$wiki] = [];
         }
         $retVal = 1;
         $cmd = wfShellWikiCmd("{$IP}/maintenance/getConfiguration.php", ['--wiki', $wiki, '--settings', implode(' ', $settings), '--format', 'PHP']);
         // ulimit5.sh breaks this call
         $data = trim(wfShellExec($cmd, $retVal, [], ['memory' => 0]));
         if ($retVal != 0 || !strlen($data)) {
             throw new MWException("Failed to run getConfiguration.php.");
         }
         $res = unserialize($data);
         if (!is_array($res)) {
             throw new MWException("Failed to unserialize configuration array.");
         }
         $this->cfgCache[$wiki] = $this->cfgCache[$wiki] + $res;
     }
     return $multi ? $res : current($res);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:55,代码来源:SiteConfiguration.php


示例6: wfShellMaintenanceCmd

/**
 * Alias to wfShellWikiCmd()
 *
 * @see wfShellWikiCmd()
 */
function wfShellMaintenanceCmd($script, array $parameters = array(), array $options = array())
{
    return wfShellWikiCmd($script, $parameters, $options);
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:9,代码来源:GlobalFunctions.php


示例7: doJobs

	/**
	 * Do a job from the job queue
	 */
	private function doJobs() {
		global $wgJobRunRate, $wgPhpCli, $IP;

		if ( $wgJobRunRate <= 0 || wfReadOnly() ) {
			return;
		}

		if ( $wgJobRunRate < 1 ) {
			$max = mt_getrandmax();
			if ( mt_rand( 0, $max ) > $max * $wgJobRunRate ) {
				return; // the higher $wgJobRunRate, the less likely we return here
			}
			$n = 1;
		} else {
			$n = intval( $wgJobRunRate );
		}

		if ( !wfShellExecDisabled() && is_executable( $wgPhpCli ) ) {
			// Start a background process to run some of the jobs
			wfProfileIn( __METHOD__ . '-exec' );
			$retVal = 1;
			$cmd = wfShellWikiCmd( "$IP/maintenance/runJobs.php", array( '--maxjobs', $n ) );
			$cmd .= " >" . wfGetNull() . " 2>&1"; // don't hang PHP on pipes
			if ( wfIsWindows() ) {
				// Using START makes this async and also works around a bug where using
				// wfShellExec() with a quoted script name causes a filename syntax error.
				$cmd = "START /B \"bg\" $cmd";
			} else {
				$cmd = "$cmd &";
			}
			wfShellExec( $cmd, $retVal );
			wfProfileOut( __METHOD__ . '-exec' );
		} else {
			try {
				// Fallback to running the jobs here while the user waits
				$group = JobQueueGroup::singleton();
				do {
					$job = $group->pop( JobQueueGroup::USE_CACHE ); // job from any queue
					if ( $job ) {
						$output = $job->toString() . "\n";
						$t = - microtime( true );
						wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
						$success = $job->run();
						wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
						$group->ack( $job ); // done
						$t += microtime( true );
						$t = round( $t * 1000 );
						if ( $success === false ) {
							$output .= "Error: " . $job->getLastError() . ", Time: $t ms\n";
						} else {
							$output .= "Success, Time: $t ms\n";
						}
						wfDebugLog( 'jobqueue', $output );
					}
				} while ( --$n && $job );
			} catch ( MWException $e ) {
				// We don't want exceptions thrown during job execution to
				// be reported to the user since the output is already sent.
				// Instead we just log them.
				MWExceptionHandler::logException( $e );
			}
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:66,代码来源:Wiki.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wfShorthandToInteger函数代码示例发布时间:2022-05-23
下一篇:
PHP wfShellExecWithStderr函数代码示例发布时间: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