コード例 #1
0
	public function __construct() {
		global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite;
		$target = $wgRequest->getVal( 'testwiki' );
		$target = IncubatorTest::analyzePrefix( $target );
		$project = isset( $target['project'] ) ? $target['project'] : '';
		$lang = isset( $target['lang'] ) ? $target['lang'] : '';
		if( IncubatorTest::isContentProject() || ( $project && $lang ) ) {
			$dbr = wfGetDB( DB_SLAVE );
			$this->extra[] = 'page_title' .
				$dbr->buildLike( IncubatorTest::displayPrefix( $project, $lang ) . '/', $dbr->anyString() );
		} elseif( $wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) {
			# project or help namespace
			$this->extra['page_namespace'] = array( 4, 12 );
		}
		parent::__construct( 'RandomByTest' );
	}
コード例 #2
0
	/**
	 * Whether we should use the feature of custom logos per project
	 * @param $title Title object
	 * @return false or Array from analyzePrefix()
	 */
	static function shouldWeSetCustomLogo( $title ) {
		$prefix = IncubatorTest::analyzePrefix( $title->getText() );

		# Maybe do later something like if( isContentProject() && 'recentchanges' ) { return true; }

		# return if the page does not have a valid prefix (info page is considered valid)
		if( $prefix['error'] ) {
			return false;
		}
		# display the custom logo only if &testwiki=wx/xx or the user's pref is set to the current test wiki
		if( self::displayPrefix() != $prefix['prefix'] ) {
			return false;
		}
		global $wmincTestWikiNamespaces;
		# return if the page is not in one of the test wiki namespaces
		if( !in_array( $title->getNamespace(), (array)$wmincTestWikiNamespaces ) ) {
			return false;
		}
		return $prefix;
	}