コード例 #1
0
 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportSource $source
  * @param Config $config
  */
 function __construct(ImportSource $source, Config $config = null)
 {
     $this->reader = new XMLReader();
     if (!$config) {
         wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
         $config = ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $this->config = $config;
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     if (defined('LIBXML_PARSEHUGE')) {
         $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $this->reader->open("uploadsource://{$id}");
     }
     // Default callbacks
     $this->setPageCallback(array($this, 'beforeImportPage'));
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
     $this->importTitleFactory = new NaiveImportTitleFactory();
 }
コード例 #2
0
 /**
  * @param &$reader LogReader: where to get our data from
  * @param $flags Integer: Bitwise combination of flags:
  *     LogEventsList::NO_ACTION_LINK   Don't show restore/unblock/block links
  *
  * @deprecated since 1.14
  */
 function __construct(&$reader, $flags = 0)
 {
     wfDeprecated(__METHOD__);
     $this->reader =& $reader;
     $this->reader->pager->mLogEventsList->flags = $flags;
     # Aliases for shorter code...
     $this->pager =& $this->reader->pager;
     $this->list =& $this->reader->pager->mLogEventsList;
 }
コード例 #3
0
ファイル: StripState.php プロジェクト: claudinec/galan-wiki
 /**
  * @param string|null $prefix
  * @since 1.26 The prefix argument should be omitted, as the strip marker
  *  prefix string is now a constant.
  */
 public function __construct($prefix = null)
 {
     if ($prefix !== null) {
         wfDeprecated(__METHOD__ . ' with called with $prefix argument' . ' (call with no arguments instead)', '1.26');
     }
     $this->data = ['nowiki' => [], 'general' => []];
     $this->regex = '/' . Parser::MARKER_PREFIX . "([^<>&'\"]+)" . Parser::MARKER_SUFFIX . '/';
     $this->circularRefGuard = [];
 }
コード例 #4
0
ファイル: LBFactory.php プロジェクト: whysasse/kmwiki
 /**
  * Returns the LBFactory class to use and the load balancer configuration.
  *
  * @param array $config (e.g. $wgLBFactoryConf)
  * @return string Class name
  */
 public static function getLBFactoryClass(array $config)
 {
     // For configuration backward compatibility after removing
     // underscores from class names in MediaWiki 1.23.
     $bcClasses = array('LBFactory_Simple' => 'LBFactorySimple', 'LBFactory_Single' => 'LBFactorySingle', 'LBFactory_Multi' => 'LBFactoryMulti', 'LBFactory_Fake' => 'LBFactoryFake');
     $class = $config['class'];
     if (isset($bcClasses[$class])) {
         $class = $bcClasses[$class];
         wfDeprecated('$wgLBFactoryConf must be updated. See RELEASE-NOTES for details', '1.23');
     }
     return $class;
 }
コード例 #5
0
ファイル: Image.php プロジェクト: rocLv/conference
 /**
  * Return the URL of an image, provided its name.
  *
  * Backwards-compatibility for extensions.
  * Note that fromSharedDirectory will only use the shared path for files
  * that actually exist there now, and will return local paths otherwise.
  *
  * @param string $name	Name of the image, without the leading "Image:"
  * @param boolean $fromSharedDirectory	Should this be in $wgSharedUploadPath?
  * @return string URL of $name image
  * @deprecated
  */
 static function imageUrl($name, $fromSharedDirectory = false)
 {
     wfDeprecated(__METHOD__);
     $image = null;
     if ($fromSharedDirectory) {
         $image = wfFindFile($name);
     }
     if (!$image) {
         $image = wfLocalFile($name);
     }
     return $image->getUrl();
 }
コード例 #6
0
ファイル: LogEventsList.php プロジェクト: nahoj/mediawiki_ynh
	/**
	 * Set page title and show header for this log type
	 * @param $type Array
	 * @deprecated in 1.19
	 */
	public function showHeader( $type ) {
		wfDeprecated( __METHOD__, '1.19' );
		// If only one log type is used, then show a special message...
		$headerType = count( $type ) == 1 ? $type[0] : '';
		$out = $this->getOutput();
		if ( LogPage::isLogType( $headerType ) ) {
			$page = new LogPage( $headerType );
			$out->setPageTitle( $page->getName()->text() );
			$out->addHTML( $page->getDescription()->parseAsBlock() );
		} else {
			$out->addHTML( $this->msg( 'alllogstext' )->parse() );
		}
	}
コード例 #7
0
 /**
  * @param string $address String with an email address, or a User object
  * @param string $name Human-readable name if a string address is given
  * @param string $realName Human-readable real name if a string address is given
  */
 function __construct($address, $name = null, $realName = null)
 {
     if (is_object($address) && $address instanceof User) {
         // Old calling format, now deprecated
         wfDeprecated(__METHOD__ . ' with a User object', '1.24');
         $this->address = $address->getEmail();
         $this->name = $address->getName();
         $this->realName = $address->getRealName();
     } else {
         $this->address = strval($address);
         $this->name = strval($name);
         $this->realName = strval($realName);
     }
 }
コード例 #8
0
ファイル: LinkFilter.php プロジェクト: rocLv/conference
 /**
  * Make a string to go after an SQL LIKE, which will match the specified
  * string. There are several kinds of filter entry:
  *     *.domain.com    -  Produces http://com.domain.%, matches domain.com
  *                        and www.domain.com
  *     domain.com      -  Produces http://com.domain./%, matches domain.com
  *                        or domain.com/ but not www.domain.com
  *     *.domain.com/x  -  Produces http://com.domain.%/x%, matches
  *                        www.domain.com/xy
  *     domain.com/x    -  Produces http://com.domain./x%, matches
  *                        domain.com/xy but not www.domain.com/xy
  *
  * Asterisks in any other location are considered invalid.
  * 
  * @param $filterEntry String: domainparts
  * @param $prot        String: protocol
  * @return String
  * @deprecated Use makeLikeArray() and pass result to Database::buildLike() instead
  */
 public static function makeLike($filterEntry, $prot = 'http://')
 {
     wfDeprecated(__METHOD__);
     $like = self::makeLikeArray($filterEntry, $prot);
     if (!$like) {
         return false;
     }
     $dbw = wfGetDB(DB_MASTER);
     $s = $dbw->buildLike($like);
     $m = false;
     if (preg_match("/^ *LIKE '(.*)' *\$/", $s, $m)) {
         return $m[1];
     } else {
         throw new MWException(__METHOD__ . ': this DBMS is not supported by this function.');
     }
 }
コード例 #9
0
 function _newObject()
 {
     /* Put the caller offset for wfDeprecated as 6, as
      * that gives the function that uses this object, since:
      * 1 = this function ( _newObject )
      * 2 = StubObject::_unstub
      * 3 = StubObject::_call
      * 4 = StubObject::__call
      * 5 = DeprecatedGlobal::<method of global called>
      * 6 = Actual function using the global.
      * Of course its theoretically possible to have other call
      * sequences for this method, but that seems to be
      * rather unlikely.
      */
     wfDeprecated('$' . $this->mGlobal, $this->mVersion, false, 6);
     return $this->mRealValue;
 }
コード例 #10
0
ファイル: ProxyTools.php プロジェクト: eFFemeer/seizamcore
/**
 * Returns the browser/OS data from the request header
 * Note: headers are spoofable
 *
 * @deprecated in 1.18; use $wgRequest->getHeader( 'User-Agent' ) instead.
 * @return string
 */
function wfGetAgent()
{
    wfDeprecated(__FUNCTION__);
    if (function_exists('apache_request_headers')) {
        // More reliable than $_SERVER due to case and -/_ folding
        $set = array();
        foreach (apache_request_headers() as $tempName => $tempValue) {
            $set[strtoupper($tempName)] = $tempValue;
        }
        $index = strtoupper('User-Agent');
    } else {
        // Subject to spoofing with headers like X_Forwarded_For
        $set = $_SERVER;
        $index = 'HTTP_USER_AGENT';
    }
    if (isset($set[$index])) {
        return $set[$index];
    } else {
        return '';
    }
}
コード例 #11
0
 function __construct($p = null)
 {
     global $wgSharedDB, $wgSQLiteDataDir;
     if (!is_array($p)) {
         // legacy calling pattern
         wfDeprecated(__METHOD__ . " method called without parameter array.", "1.22");
         $args = func_get_args();
         $p = array('host' => isset($args[0]) ? $args[0] : false, 'user' => isset($args[1]) ? $args[1] : false, 'password' => isset($args[2]) ? $args[2] : false, 'dbname' => isset($args[3]) ? $args[3] : false, 'flags' => isset($args[4]) ? $args[4] : 0, 'tablePrefix' => isset($args[5]) ? $args[5] : 'get from global', 'schema' => 'get from global', 'foreign' => isset($args[6]) ? $args[6] : false);
     }
     $this->mDBname = $p['dbname'];
     parent::__construct($p);
     // parent doesn't open when $user is false, but we can work with $dbName
     if ($p['dbname'] && !$this->isOpen()) {
         if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
             if ($wgSharedDB) {
                 $this->attachDatabase($wgSharedDB);
             }
         }
     }
     $this->lockMgr = new FSLockManager(array('lockDirectory' => "{$wgSQLiteDataDir}/locks"));
 }
コード例 #12
0
ファイル: Import.php プロジェクト: xiebinyi/mediawiki
 /**
  * Creates an ImportXMLReader drawing from the source provided
  * @param ImportSource $source
  * @param Config $config
  * @throws Exception
  */
 function __construct(ImportSource $source, Config $config = null)
 {
     if (!class_exists('XMLReader')) {
         throw new Exception('Import requires PHP to have been compiled with libxml support');
     }
     $this->reader = new XMLReader();
     if (!$config) {
         wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
         $config = ConfigFactory::getDefaultInstance()->makeConfig('main');
     }
     $this->config = $config;
     if (!in_array('uploadsource', stream_get_wrappers())) {
         stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
     }
     $id = UploadSourceAdapter::registerSource($source);
     // Enable the entity loader, as it is needed for loading external URLs via
     // XMLReader::open (T86036)
     $oldDisable = libxml_disable_entity_loader(false);
     if (defined('LIBXML_PARSEHUGE')) {
         $status = $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
     } else {
         $status = $this->reader->open("uploadsource://{$id}");
     }
     if (!$status) {
         $error = libxml_get_last_error();
         libxml_disable_entity_loader($oldDisable);
         throw new MWException('Encountered an internal error while initializing WikiImporter object: ' . $error->message);
     }
     libxml_disable_entity_loader($oldDisable);
     // Default callbacks
     $this->setPageCallback(array($this, 'beforeImportPage'));
     $this->setRevisionCallback(array($this, "importRevision"));
     $this->setUploadCallback(array($this, 'importUpload'));
     $this->setLogItemCallback(array($this, 'importLogItem'));
     $this->setPageOutCallback(array($this, 'finishImportPage'));
     $this->importTitleFactory = new NaiveImportTitleFactory();
 }
コード例 #13
0
ファイル: Title.php プロジェクト: MediaWiki-stable/1.26.1
 /**
  * Move this page without authentication
  *
  * @deprecated since 1.25 use MovePage class instead
  * @param Title $nt The new page Title
  * @return array|bool True on success, getUserPermissionsErrors()-like array on failure
  */
 public function moveNoAuth(&$nt)
 {
     wfDeprecated(__METHOD__, '1.25');
     return $this->moveTo($nt, false);
 }
コード例 #14
0
 /**
  * Fetch an appropriate changes list class for the main context
  * This first argument used to be an User object.
  *
  * @deprecated in 1.18; use newFromContext() instead
  * @param $unused Unused
  * @return ChangesList|EnhancedChangesList|OldChangesList derivative
  */
 public static function newFromUser($unused)
 {
     wfDeprecated(__METHOD__, '1.18');
     return self::newFromContext(RequestContext::getMain());
 }
コード例 #15
0
ファイル: MagicWord.php プロジェクト: Acidburn0zzz/mediawiki
 /**
  * $magicarr is an associative array of (magic word ID => replacement)
  * This method uses the php feature to do several replacements at the same time,
  * thereby gaining some efficiency. The result is placed in the out variable
  * $result. The return value is true if something was replaced.
  * @deprecated since 1.25, unused
  *
  * @param array $magicarr
  * @param string $subject
  * @param string $result
  *
  * @return bool
  */
 function replaceMultiple($magicarr, $subject, &$result)
 {
     wfDeprecated(__METHOD__, '1.25');
     $search = array();
     $replace = array();
     foreach ($magicarr as $id => $replacement) {
         $mw = MagicWord::get($id);
         $search[] = $mw->getRegex();
         $replace[] = $replacement;
     }
     $result = preg_replace($search, $replace, $subject);
     return $result !== $subject;
 }
コード例 #16
0
ファイル: ProfilerSimple.php プロジェクト: seedbank/old-repo
 /**
  * Get the actual CPU time or the initial one if $ru is set.
  *
  * @deprecated in 1.20
  * @return float|null
  */
 function getCpuTime($ru = null)
 {
     wfDeprecated(__METHOD__, '1.20');
     if ($ru === null) {
         return $this->getTime('cpu');
     } else {
         # It theory we should use $ru here, but it always $wgRUstart that is passed here
         return $this->getInitialTime('cpu');
     }
 }
コード例 #17
0
ファイル: WebRequest.php プロジェクト: mangowi/mediawiki
 /**
  * Returns true if the PATH_INFO ends with an extension other than a script
  * extension. This could confuse IE for scripts that send arbitrary data which
  * is not HTML but may be detected as such.
  *
  * Various past attempts to use the URL to make this check have generally
  * run up against the fact that CGI does not provide a standard method to
  * determine the URL. PATH_INFO may be mangled (e.g. if cgi.fix_pathinfo=0),
  * but only by prefixing it with the script name and maybe some other stuff,
  * the extension is not mangled. So this should be a reasonably portable
  * way to perform this security check.
  *
  * Also checks for anything that looks like a file extension at the end of
  * QUERY_STRING, since IE 6 and earlier will use this to get the file type
  * if there was no dot before the question mark (bug 28235).
  *
  * @deprecated Use checkUrlExtension().
  *
  * @param $extWhitelist array
  *
  * @return bool
  */
 public function isPathInfoBad($extWhitelist = array())
 {
     wfDeprecated(__METHOD__, '1.17');
     global $wgScriptExtension;
     $extWhitelist[] = ltrim($wgScriptExtension, '.');
     return IEUrlExtension::areServerVarsBad($_SERVER, $extWhitelist);
 }
コード例 #18
0
ファイル: ApiResult.php プロジェクト: Acidburn0zzz/mediawiki
 /**
  * Converts a Status object to an array suitable for addValue
  * @deprecated since 1.25, use ApiErrorFormatter::arrayFromStatus()
  * @param Status $status
  * @param string $errorType
  * @return array
  */
 public function convertStatusToArray($status, $errorType = 'error')
 {
     wfDeprecated(__METHOD__, '1.25');
     return $this->errorFormatter->arrayFromStatus($status, $errorType);
 }
コード例 #19
0
ファイル: ApiQuery.php プロジェクト: Tarendai/spring-website
 /**
  * Get the generators array mapping module names to class names
  * @deprecated since 1.21, list of generators is maintained by ApiPageSet
  * @return array array(modulename => classname)
  */
 public function getGenerators()
 {
     wfDeprecated(__METHOD__, '1.21');
     $gens = array();
     foreach ($this->mModuleMgr->getNamesWithClasses() as $name => $class) {
         if (is_subclass_of($class, 'ApiQueryGeneratorBase')) {
             $gens[$name] = $class;
         }
     }
     return $gens;
 }
コード例 #20
0
ファイル: File.php プロジェクト: mangowi/mediawiki
 /**
  * Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case
  * encoding, zero padded to 31 digits.
  *
  * 160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36
  * fairly neatly.
  *
  * @param $path string
  *
  * @return bool|string False on failure
  * @deprecated since 1.19
  */
 static function sha1Base36($path)
 {
     wfDeprecated(__METHOD__, '1.19');
     $fsFile = new FSFile($path);
     return $fsFile->getSha1Base36();
 }
コード例 #21
0
ファイル: WikiPage.php プロジェクト: nahoj/mediawiki_ynh
	/**
	 * @deprecated since 1.18
	 * @param $oldid int
	 * @return bool
	 */
	public function useParserCache( $oldid ) {
		wfDeprecated( __METHOD__, '1.18' );
		global $wgUser;
		return $this->isParserCacheUsed( ParserOptions::newFromUser( $wgUser ), $oldid );
	}
コード例 #22
0
ファイル: Preferences.php プロジェクト: nahoj/mediawiki_ynh
	/**
	 * @deprecated in 1.19
	 * @param $user User
	 * @return array
	 */
	public static function loadOldSearchNs( $user ) {
		wfDeprecated( __METHOD__, '1.19' );

		$searchableNamespaces = SearchEngine::searchableNamespaces();
		// Back compat with old format
		$arr = array();

		foreach ( $searchableNamespaces as $ns => $name ) {
			if ( $user->getOption( 'searchNs' . $ns ) ) {
				$arr[] = $ns;
			}
		}

		return $arr;
	}
コード例 #23
0
 /**
  * Returns the export schema version.
  * @deprecated since 1.20; use WikiExporter::schemaVersion() instead
  * @return string
  */
 function schemaVersion()
 {
     wfDeprecated(__METHOD__, '1.20');
     return WikiExporter::schemaVersion();
 }
コード例 #24
0
ファイル: Xml.php プロジェクト: Tarendai/spring-website
 /**
  * Build a drop-down box for selecting a namespace
  *
  * @param $selected Mixed: Namespace which should be pre-selected
  * @param $all Mixed: Value of an item denoting all namespaces, or null to omit
  * @param $element_name String: value of the "name" attribute of the select tag
  * @param string $label optional label to add to the field
  * @return string
  * @deprecated since 1.19
  */
 public static function namespaceSelector($selected = '', $all = null, $element_name = 'namespace', $label = null)
 {
     wfDeprecated(__METHOD__, '1.19');
     return Html::namespaceSelector(array('selected' => $selected, 'all' => $all, 'label' => $label), array('name' => $element_name, 'id' => 'namespace', 'class' => 'namespaceselector'));
 }
コード例 #25
0
 /**
  * This function takes a number of message/argument specifications, wraps them in
  * some overall structure, and then parses the result and adds it to the output.
  *
  * In the $wrap, $1 is replaced with the first message, $2 with the second,
  * and so on. The subsequent arguments may be either
  * 1) strings, in which case they are message names, or
  * 2) arrays, in which case, within each array, the first element is the message
  *    name, and subsequent elements are the parameters to that message.
  *
  * Don't use this for messages that are not in the user's interface language.
  *
  * For example:
  *
  *    $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>", 'some-error' );
  *
  * Is equivalent to:
  *
  *    $wgOut->addWikiText( "<div class='error'>\n"
  *        . wfMessage( 'some-error' )->plain() . "\n</div>" );
  *
  * The newline after the opening div is needed in some wikitext. See bug 19226.
  *
  * @param string $wrap
  */
 public function wrapWikiMsg($wrap)
 {
     $msgSpecs = func_get_args();
     array_shift($msgSpecs);
     $msgSpecs = array_values($msgSpecs);
     $s = $wrap;
     foreach ($msgSpecs as $n => $spec) {
         if (is_array($spec)) {
             $args = $spec;
             $name = array_shift($args);
             if (isset($args['options'])) {
                 unset($args['options']);
                 wfDeprecated('Adding "options" to ' . __METHOD__ . ' is no longer supported', '1.20');
             }
         } else {
             $args = array();
             $name = $spec;
         }
         $s = str_replace('$' . ($n + 1), $this->msg($name, $args)->plain(), $s);
     }
     $this->addWikiText($s);
 }
コード例 #26
0
ファイル: ApiMain.php プロジェクト: soumyag213/mediawiki
 /**
  * Check whether the user wants us to show version information in the API help
  * @return bool
  * @deprecated since 1.21, always returns false
  */
 public function getShowVersions()
 {
     wfDeprecated(__METHOD__, '1.21');
     return false;
 }
コード例 #27
0
 /**
  * @deprecated since 1.25
  */
 public function getWantsHelp()
 {
     wfDeprecated(__METHOD__, '1.25');
     // Help is always ugly in JSON
     return false;
 }
コード例 #28
0
ファイル: Linker.php プロジェクト: eFFemeer/seizamcore
 /**
  * Generate either a normal exists-style link or a stub link, depending
  * on the given page size.
  *
  * @param $size Integer
  * @param $nt Title object.
  * @param $text String
  * @param $query String
  * @param $trail String
  * @param $prefix String
  * @return string HTML of link
  * @deprecated since 1.17
  */
 static function makeSizeLinkObj($size, $nt, $text = '', $query = '', $trail = '', $prefix = '')
 {
     global $wgUser;
     wfDeprecated(__METHOD__);
     $threshold = $wgUser->getStubThreshold();
     $colour = $size < $threshold ? 'stub' : '';
     // @todo FIXME: Replace deprecated makeColouredLinkObj by link()
     return self::makeColouredLinkObj($nt, $colour, $text, $query, $trail, $prefix);
 }
コード例 #29
0
 /**
  * @deprecated since 1.18 No modern skin generates language links this way, please use language links
  *                        data to generate your own HTML.
  * @param $languages array
  * @return string
  */
 private function languagesHtml($languages)
 {
     wfDeprecated(__METHOD__, '1.18');
     global $wgContLang, $wgHideInterlanguageLinks;
     if ($wgHideInterlanguageLinks || count($languages) == 0) {
         return '';
     }
     $s = htmlspecialchars(wfMessage('otherlanguages')->text() . wfMessage('colon-separator')->text());
     $langs = array();
     foreach ($languages as $l) {
         $nt = Title::newFromText($l);
         $text = Language::fetchLanguageName($nt->getInterwiki());
         $langs[] = Html::element('a', array('href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external"), $text == '' ? $l : $text);
     }
     $s .= implode(wfMessage('pipe-separator')->escaped(), $langs);
     if ($wgContLang->isRTL()) {
         $s = Html::rawElement('span', array('dir' => "LTR"), $s);
     }
     return $s;
 }
コード例 #30
0
ファイル: HTMLForm.php プロジェクト: h4ck3rm1k3/mediawiki
 /**
  * Add the HTMLForm-specific JavaScript, if it hasn't been
  * done already.
  * @deprecated since 1.18 load modules with ResourceLoader instead
  */
 static function addJS()
 {
     wfDeprecated(__METHOD__, '1.18');
 }