Merge "Hot-fix for mismatching lens from database"
authorBrion VIBBER <brion@wikimedia.org>
Wed, 25 Apr 2012 19:43:25 +0000 (19:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 25 Apr 2012 19:43:25 +0000 (19:43 +0000)
37 files changed:
docs/hooks.txt
includes/AutoLoader.php
includes/OutputPage.php
includes/WebRequest.php
includes/api/ApiTokens.php
includes/filerepo/FileRepo.php
includes/filerepo/backend/FSFileBackend.php
includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/FileBackendMultiWrite.php
includes/filerepo/backend/FileBackendStore.php
includes/filerepo/backend/SwiftFileBackend.php
includes/filerepo/file/File.php
includes/filerepo/file/ForeignAPIFile.php
includes/filerepo/file/LocalFile.php
includes/parser/Parser.php
languages/messages/MessagesBn.php
languages/messages/MessagesCs.php
languages/messages/MessagesDa.php
languages/messages/MessagesDsb.php
languages/messages/MessagesEs.php
languages/messages/MessagesFi.php
languages/messages/MessagesFr.php
languages/messages/MessagesHe.php
languages/messages/MessagesHsb.php
languages/messages/MessagesJa.php
languages/messages/MessagesKa.php
languages/messages/MessagesLb.php
languages/messages/MessagesMk.php
languages/messages/MessagesMl.php
languages/messages/MessagesMs.php
languages/messages/MessagesNl.php
languages/messages/MessagesPt.php
languages/messages/MessagesRo.php
languages/messages/MessagesYi.php
maintenance/refreshLinks.php
resources/mediawiki/mediawiki.js
tests/phpunit/includes/filerepo/FileBackendTest.php

index d87bd3d..1a9f41d 100644 (file)
@@ -395,6 +395,11 @@ In this data array, the key-value-pair identified by the apiLink key is
 required.
 &$apis: array of services
 
+'ApiTokensGetTokenTypes': use this hook to extend action=tokens with new
+token types.
+&$tokenTypes: supported token types in format 'type' => callback function
+used to retrieve this type of tokens.
+
 'ArticleAfterFetchContent': after fetching content of an article from
 the database
 $article: the article (object) being loaded from the database
index 60cbbaa..937f09c 100644 (file)
@@ -510,10 +510,16 @@ $wgAutoloadLocalClasses = array(
        'FileBackend' => 'includes/filerepo/backend/FileBackend.php',
        'FileBackendStore' => 'includes/filerepo/backend/FileBackendStore.php',
        'FileBackendStoreShardListIterator' => 'includes/filerepo/backend/FileBackendStore.php',
+       'FileBackendStoreShardDirIterator' => 'includes/filerepo/backend/FileBackendStore.php',
+       'FileBackendStoreShardFileIterator' => 'includes/filerepo/backend/FileBackendStore.php',
        'FileBackendMultiWrite' => 'includes/filerepo/backend/FileBackendMultiWrite.php',
        'FSFileBackend' => 'includes/filerepo/backend/FSFileBackend.php',
+       'FSFileBackendList' => 'includes/filerepo/backend/FSFileBackend.php',
+       'FSFileBackendDirList' => 'includes/filerepo/backend/FSFileBackend.php',
        'FSFileBackendFileList' => 'includes/filerepo/backend/FSFileBackend.php',
        'SwiftFileBackend' => 'includes/filerepo/backend/SwiftFileBackend.php',
+       'SwiftFileBackendList' => 'includes/filerepo/backend/SwiftFileBackend.php',
+       'SwiftFileBackendDirList' => 'includes/filerepo/backend/SwiftFileBackend.php',
        'SwiftFileBackendFileList' => 'includes/filerepo/backend/SwiftFileBackend.php',
        'FileJournal' => 'includes/filerepo/backend/filejournal/FileJournal.php',
        'DBFileJournal' => 'includes/filerepo/backend/filejournal/DBFileJournal.php',
index beaca5f..3ef7ceb 100644 (file)
@@ -2573,12 +2573,24 @@ $templates
                                $extraQuery
                        );
                        $context = new ResourceLoaderContext( $resourceLoader, new FauxRequest( $query ) );
-                       // Drop modules that know they're empty
+                       // Extract modules that know they're empty
+                       $emptyModules = array ();
                        foreach ( $modules as $key => $module ) {
                                if ( $module->isKnownEmpty( $context ) ) {
+                                       $emptyModules[$key] = 'ready';
                                        unset( $modules[$key] );
                                }
                        }
+                       // Inline empty modules: since they're empty, just mark them as 'ready'
+                       if ( count( $emptyModules ) > 0 && $only !== ResourceLoaderModule::TYPE_STYLES ) {
+                               // If we're only getting the styles, we don't need to do anything for empty modules.
+                               $links .= Html::inlineScript(\r
+                                               ResourceLoader::makeLoaderConditionalScript(\r
+                                                               ResourceLoader::makeLoaderStateScript( $emptyModules )\r
+                                               )\r
+                               ) . "\n";
+                       }
+
                        // If there are no modules left, skip this group
                        if ( $modules === array() ) {
                                continue;
@@ -2642,7 +2654,7 @@ $templates
                                // Automatically select style/script elements
                                if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
                                        $link = Html::linkedStyle( $url );
-                               } else if ( $loadCall ) { 
+                               } else if ( $loadCall ) {
                                        $link = Html::inlineScript(
                                                ResourceLoader::makeLoaderConditionalScript(
                                                        Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) )
@@ -2670,7 +2682,7 @@ $templates
         */
        function getHeadScripts() {
                global $wgResourceLoaderExperimentalAsyncLoading;
-               
+
                // Startup - this will immediately load jquery and mediawiki modules
                $scripts = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
 
@@ -2702,7 +2714,7 @@ $templates
                                )
                        );
                }
-               
+
                if ( $wgResourceLoaderExperimentalAsyncLoading ) {
                        $scripts .= $this->getScriptsForBottomQueue( true );
                }
@@ -2748,43 +2760,87 @@ $templates
                // Legacy Scripts
                $scripts .= "\n" . $this->mScripts;
 
-               $userScripts = array();
+               $defaultModules = array();
 
                // Add site JS if enabled
                if ( $wgUseSiteJs ) {
                        $scripts .= $this->makeResourceLoaderLink( 'site', ResourceLoaderModule::TYPE_SCRIPTS,
                                /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
                        );
-                       if( $this->getUser()->isLoggedIn() ){
-                               $userScripts[] = 'user.groups';
-                       }
+                       $defaultModules['site'] = 'loading';
+               } else {
+                       // The wiki is configured to not allow a site module.
+                       $defaultModules['site'] = 'missing';
                }
 
                // Add user JS if enabled
-               if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() ) {
-                       if( $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
-                               # XXX: additional security check/prompt?
-                               // We're on a preview of a JS subpage
-                               // Exclude this page from the user module in case it's in there (bug 26283)
-                               $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
-                                       array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
-                               );
-                               // Load the previewed JS
-                               $scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
+               if ( $wgAllowUserJs ) {
+                       if ( $this->getUser()->isLoggedIn() ) {
+                               if( $this->getTitle() && $this->getTitle()->isJsSubpage() && $this->userCanPreview() ) {
+                                       # XXX: additional security check/prompt?
+                                       // We're on a preview of a JS subpage
+                                       // Exclude this page from the user module in case it's in there (bug 26283)
+                                       $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
+                                               array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() ), $inHead
+                                       );
+                                       // Load the previewed JS
+                                       $scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
+                                       // FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
+                                       // asynchronously and may arrive *after* the inline script here. So the previewed code
+                                       // may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js...
+                               } else {
+                                       // Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
+                                       $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS,
+                                               /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
+                                       );
+                               }
+                               $defaultModules['user'] = 'loading';
                        } else {
-                               // Include the user module normally
-                               // We can't do $userScripts[] = 'user'; because the user module would end up
-                               // being wrapped in a closure, so load it raw like 'site'
-                               $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS,
+                               // Non-logged-in users have no user module. Treat it as empty and 'ready' to avoid
+                               // blocking default gadgets that might depend on it. Although arguably default-enabled
+                               // gadgets should not depend on the user module, it's harmless and less error-prone to
+                               // handle this case.
+                               $defaultModules['user'] = 'ready';
+                       }
+               } else {
+                       // User JS diabled
+                       $defaultModules['user'] = 'missing';
+               }
+
+               // Group JS is only enabled if site JS is enabled.
+               if ( $wgUseSiteJs ) {
+                       if ( $this->getUser()->isLoggedIn() ) {
+                               $scripts .= $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED,
                                        /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
                                );
+                               $defaultModules['user.groups'] = 'loading';
+                       } else {
+                               // Non-logged-in users have no user.groups module. Treat it as empty and 'ready' to
+                               // avoid blocking gadgets that might depend upon the module.
+                               $defaultModules['user.groups'] = 'ready';
                        }
+               } else {
+                       // Site (and group JS) disabled
+                       $defaultModules['user.groups'] = 'missing';
                }
-               $scripts .= $this->makeResourceLoaderLink( $userScripts, ResourceLoaderModule::TYPE_COMBINED,
-                       /* $useESI = */ false, /* $extraQuery = */ array(), /* $loadCall = */ $inHead
-               );
 
-               return $scripts;
+               $loaderInit = '';
+               if ( $inHead ) {
+                       // We generate loader calls anyway, so no need to fix the client-side loader's state to 'loading'.
+                       foreach ( $defaultModules as $m => $state ) {
+                               if ( $state == 'loading' ) {
+                                       unset( $defaultModules[$m] );
+                               }
+                       }
+               }
+               if ( count( $defaultModules ) > 0 ) {
+                       $loaderInit = Html::inlineScript(
+                               ResourceLoader::makeLoaderConditionalScript(
+                                       ResourceLoader::makeLoaderStateScript( $defaultModules )
+                               )
+                       ) . "\n";
+               }
+               return $loaderInit . $scripts;
        }
 
        /**
@@ -2939,12 +2995,11 @@ $templates
        }
 
        /**
-        * @param $unused
-        * @param $addContentType bool
+        * @param $addContentType bool: Whether <meta> specifying content type should be returned
         *
-        * @return string HTML tag links to be put in the header.
+        * @return array in format "link name or number => 'link html'".
         */
-       public function getHeadLinks( $unused = null, $addContentType = false ) {
+       public function getHeadLinksArray( $addContentType = false ) {
                global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
                        $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
                        $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
@@ -2957,20 +3012,20 @@ $templates
                        if ( $wgHtml5 ) {
                                # More succinct than <meta http-equiv=Content-Type>, has the
                                # same effect
-                               $tags[] = Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
+                               $tags['meta-charset'] = Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
                        } else {
-                               $tags[] = Html::element( 'meta', array(
+                               $tags['meta-content-type'] = Html::element( 'meta', array(
                                        'http-equiv' => 'Content-Type',
                                        'content' => "$wgMimeType; charset=UTF-8"
                                ) );
-                               $tags[] = Html::element( 'meta', array(  // bug 15835
+                               $tags['meta-content-style-type'] = Html::element( 'meta', array(  // bug 15835
                                        'http-equiv' => 'Content-Style-Type',
                                        'content' => 'text/css'
                                ) );
                        }
                }
 
-               $tags[] = Html::element( 'meta', array(
+               $tags['meta-generator'] = Html::element( 'meta', array(
                        'name' => 'generator',
                        'content' => "MediaWiki $wgVersion",
                ) );
@@ -2979,7 +3034,7 @@ $templates
                if( $p !== 'index,follow' ) {
                        // http://www.robotstxt.org/wc/meta-user.html
                        // Only show if it's different from the default robots policy
-                       $tags[] = Html::element( 'meta', array(
+                       $tags['meta-robots'] = Html::element( 'meta', array(
                                'name' => 'robots',
                                'content' => $p,
                        ) );
@@ -2990,7 +3045,7 @@ $templates
                                "/<.*?" . ">/" => '',
                                "/_/" => ' '
                        );
-                       $tags[] = Html::element( 'meta', array(
+                       $tags['meta-keywords'] = Html::element( 'meta', array(
                                'name' => 'keywords',
                                'content' =>  preg_replace(
                                        array_keys( $strip ),
@@ -3007,7 +3062,11 @@ $templates
                        } else {
                                $a = 'name';
                        }
-                       $tags[] = Html::element( 'meta',
+                       $tagName = "meta-{$tag[0]}";
+                       if ( isset( $tags[$tagName] ) ) {
+                               $tagName .= $tag[1];
+                       }
+                       $tags[$tagName] = Html::element( 'meta',
                                array(
                                        $a => $tag[0],
                                        'content' => $tag[1]
@@ -3026,14 +3085,14 @@ $templates
                                && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
                                // Original UniversalEditButton
                                $msg = $this->msg( 'edit' )->text();
-                               $tags[] = Html::element( 'link', array(
+                               $tags['universal-edit-button'] = Html::element( 'link', array(
                                        'rel' => 'alternate',
                                        'type' => 'application/x-wiki',
                                        'title' => $msg,
                                        'href' => $this->getTitle()->getLocalURL( 'action=edit' )
                                ) );
                                // Alternate edit link
-                               $tags[] = Html::element( 'link', array(
+                               $tags['alternative-edit'] = Html::element( 'link', array(
                                        'rel' => 'edit',
                                        'title' => $msg,
                                        'href' => $this->getTitle()->getLocalURL( 'action=edit' )
@@ -3046,15 +3105,15 @@ $templates
                # uses whichever one appears later in the HTML source. Make sure
                # apple-touch-icon is specified first to avoid this.
                if ( $wgAppleTouchIcon !== false ) {
-                       $tags[] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
+                       $tags['apple-touch-icon'] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
                }
 
                if ( $wgFavicon !== false ) {
-                       $tags[] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
+                       $tags['favicon'] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
                }
 
                # OpenSearch description link
-               $tags[] = Html::element( 'link', array(
+               $tags['opensearch'] = Html::element( 'link', array(
                        'rel' => 'search',
                        'type' => 'application/opensearchdescription+xml',
                        'href' => wfScript( 'opensearch_desc' ),
@@ -3066,7 +3125,7 @@ $templates
                        # for the MediaWiki API (and potentially additional custom API
                        # support such as WordPress or Twitter-compatible APIs for a
                        # blogging extension, etc)
-                       $tags[] = Html::element( 'link', array(
+                       $tags['rsd'] = Html::element( 'link', array(
                                'rel' => 'EditURI',
                                'type' => 'application/rsd+xml',
                                // Output a protocol-relative URL here if $wgServer is protocol-relative
@@ -3086,14 +3145,14 @@ $templates
                                if ( !$urlvar ) {
                                        $variants = $lang->getVariants();
                                        foreach ( $variants as $_v ) {
-                                               $tags[] = Html::element( 'link', array(
+                                               $tags["variant-$_v"] = Html::element( 'link', array(
                                                        'rel' => 'alternate',
                                                        'hreflang' => $_v,
                                                        'href' => $this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
                                                );
                                        }
                                } else {
-                                       $tags[] = Html::element( 'link', array(
+                                       $tags['canonical'] = Html::element( 'link', array(
                                                'rel' => 'canonical',
                                                'href' => $this->getTitle()->getCanonicalUrl()
                                        ) );
@@ -3116,7 +3175,7 @@ $templates
                }
 
                if ( $copyright ) {
-                       $tags[] = Html::element( 'link', array(
+                       $tags['copyright'] = Html::element( 'link', array(
                                'rel' => 'copyright',
                                'href' => $copyright )
                        );
@@ -3165,7 +3224,17 @@ $templates
                                }
                        }
                }
-               return implode( "\n", $tags );
+               return $tags;
+       }
+
+       /**
+        * @param $unused
+        * @param $addContentType bool: Whether <meta> specifying content type should be returned
+        *
+        * @return string HTML tag links to be put in the header.
+        */
+       public function getHeadLinks( $unused = null, $addContentType = false ) {
+               return implode( "\n", $this->getHeadLinksArray( $addContentType ) );
        }
 
        /**
@@ -3260,7 +3329,7 @@ $templates
                                $otherTags .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
                                        array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
                                );
-                               
+
                                // Load the previewed CSS
                                // If needed, Janus it first. This is user-supplied CSS, so it's
                                // assumed to be right for the content language directionality.
index 9d0e579..39c1b1b 100644 (file)
@@ -671,6 +671,7 @@ class WebRequest {
 
        /**
         * HTML-safe version of appendQuery().
+        * @deprecated: Deprecated in 1.20, warnings in 1.21, remove in 1.22.
         *
         * @param $query String: query string fragment; do not include initial '?'
         * @return String
index 7964095..4a68826 100644 (file)
@@ -35,19 +35,16 @@ class ApiTokens extends ApiBase {
        }
 
        public function execute() {
+               wfProfileIn( __METHOD__ );
                $params = $this->extractRequestParams();
                $res = array();
 
+               $types = $this->getTokenTypes();
                foreach ( $params['type'] as $type ) {
                        $type = strtolower( $type );
-                       $func = 'get' .
-                                       ucfirst( $type ) .
-                                       'Token';
-                       if ( $type === 'patrol' ) {
-                               $val = call_user_func( array( 'ApiQueryRecentChanges', $func ), null, null );
-                       } else {
-                               $val = call_user_func( array( 'ApiQueryInfo', $func ), null, null );
-                       }
+
+                       $val = call_user_func( $types[$type], null, null );
+
                        if ( $val === false ) {
                                $this->setWarning( "Action '$type' is not allowed for the current user" );
                        } else {
@@ -56,6 +53,25 @@ class ApiTokens extends ApiBase {
                }
 
                $this->getResult()->addValue( null, $this->getModuleName(), $res );
+               wfProfileOut( __METHOD__ );
+       }
+
+       private function getTokenTypes() {
+               static $types = null;
+               if ( $types ) {
+                       return $types;
+               }
+               wfProfileIn( __METHOD__ );
+               $types = array( 'patrol' => 'ApiQueryRecentChanges::getPatrolToken' );
+               $names = array( 'edit', 'delete', 'protect', 'move', 'block', 'unblock',
+                       'email', 'import', 'watch' );
+               foreach ( $names as $name ) {
+                       $types[$name] = 'ApiQUeryInfo::get' . ucfirst( $name ) . 'Token';
+               }
+               wfRunHooks( 'ApiTokensGetTokenTypes', array( &$types ) );
+               ksort( $types );
+               wfProfileOut( __METHOD__ );
+               return $types;
        }
 
        public function getAllowedParams() {
@@ -63,11 +79,8 @@ class ApiTokens extends ApiBase {
                        'type' => array(
                                ApiBase::PARAM_DFLT => 'edit',
                                ApiBase::PARAM_ISMULTI => true,
-                               ApiBase::PARAM_TYPE => array(
-                                       'edit', 'delete', 'protect', 'move', 'block', 'unblock',
-                                       'email', 'import', 'watch', 'patrol'
-                               )
-                       )
+                               ApiBase::PARAM_TYPE => array_keys( $this->getTokenTypes() ),
+                       ),
                );
        }
 
index d38f5ca..196c9de 100644 (file)
@@ -782,6 +782,7 @@ class FileRepo {
        /**
         * Import a file from the local file system into the repo.
         * This does no locking nor journaling and overrides existing files.
+        * This function can be used to write to otherwise read-only foreign repos.
         * This is intended for copying generated thumbnails into the repo.
         *
         * @param $src string File system path
@@ -794,7 +795,8 @@ class FileRepo {
 
        /**
         * Purge a file from the repo. This does no locking nor journaling.
-        * This is intended for purging thumbnail.
+        * This function can be used to write to otherwise read-only foreign repos.
+        * This is intended for purging thumbnails.
         *
         * @param $path string Virtual URL or storage path
         * @return FileRepoStatus
@@ -803,17 +805,31 @@ class FileRepo {
                return $this->quickPurgeBatch( array( $path ) );
        }
 
+       /**
+        * Deletes a directory if empty.
+        * This function can be used to write to otherwise read-only foreign repos.
+        *
+        * @param $dir string Virtual URL (or storage path) of directory to clean
+        * @return Status
+        */
+       public function quickCleanDir( $dir ) {
+               $status = $this->newGood();
+               $status->merge( $this->backend->clean(
+                       array( 'dir' => $this->resolveToStoragePath( $dir ) ) ) );
+
+               return $status;
+       }
+
        /**
         * Import a batch of files from the local file system into the repo.
         * This does no locking nor journaling and overrides existing files.
+        * This function can be used to write to otherwise read-only foreign repos.
         * This is intended for copying generated thumbnails into the repo.
         *
         * @param $src Array List of tuples (file system path, virtual URL or storage path)
         * @return FileRepoStatus
         */
        public function quickImportBatch( array $pairs ) {
-               $this->assertWritableRepo(); // fail out if read-only
-
                $status = $this->newGood();
                $operations = array();
                foreach ( $pairs as $pair ) {
@@ -834,15 +850,14 @@ class FileRepo {
        }
 
        /**
-        * Purge a batch of files from the repo. This does no locking nor journaling.
-        * This is intended for purging thumbnails.
+        * Purge a batch of files from the repo.
+        * This function can be used to write to otherwise read-only foreign repos.
+        * This does no locking nor journaling and is intended for purging thumbnails.
         *
         * @param $path Array List of virtual URLs or storage paths
         * @return FileRepoStatus
         */
        public function quickPurgeBatch( array $paths ) {
-               $this->assertWritableRepo(); // fail out if read-only
-
                $status = $this->newGood();
                $operations = array();
                foreach ( $paths as $path ) {
@@ -1087,7 +1102,7 @@ class FileRepo {
        }
 
        /**
-        * Deletes a directory if empty
+        * Deletes a directory if empty.
         *
         * @param $dir string Virtual URL (or storage path) of directory to clean
         * @return Status
index 4a27ca1..df822fd 100644 (file)
@@ -7,11 +7,11 @@
 
 /**
  * @brief Class for a file system (FS) based file backend.
- * 
+ *
  * All "containers" each map to a directory under the backend's base directory.
  * For backwards-compatibility, some container paths can be set to custom paths.
  * The wiki ID will not be used in any custom paths, so this should be avoided.
- * 
+ *
  * Having directories with thousands of files will diminish performance.
  * Sharding can be accomplished by using FileRepo-style hash paths.
  *
@@ -76,7 +76,7 @@ class FSFileBackend extends FileBackendStore {
 
        /**
         * Sanity check a relative file system path for validity
-        * 
+        *
         * @param $path string Normalized relative path
         * @return bool
         */
@@ -95,14 +95,14 @@ class FSFileBackend extends FileBackendStore {
        /**
         * Given the short (unresolved) and full (resolved) name of
         * a container, return the file system path of the container.
-        * 
+        *
         * @param $shortCont string
         * @param $fullCont string
-        * @return string|null 
+        * @return string|null
         */
        protected function containerFSRoot( $shortCont, $fullCont ) {
                if ( isset( $this->containerPaths[$shortCont] ) ) {
-                       return $this->containerPaths[$shortCont]; 
+                       return $this->containerPaths[$shortCont];
                } elseif ( isset( $this->basePath ) ) {
                        return "{$this->basePath}/{$fullCont}";
                }
@@ -111,7 +111,7 @@ class FSFileBackend extends FileBackendStore {
 
        /**
         * Get the absolute file system path for a storage path
-        * 
+        *
         * @param $storagePath string Storage path
         * @return string|null
         */
@@ -439,6 +439,41 @@ class FSFileBackend extends FileBackendStore {
                clearstatcache(); // clear the PHP file stat cache
        }
 
+       /**
+        * @see FileBackendStore::doDirectoryExists()
+        * @return bool|null
+        */
+       protected function doDirectoryExists( $fullCont, $dirRel, array $params ) {
+               list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+               $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
+               $dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
+
+               $this->trapWarnings(); // don't trust 'false' if there were errors
+               $exists = is_dir( $dir );
+               $hadError = $this->untrapWarnings();
+
+               return $hadError ? null : $exists;
+       }
+
+       /**
+        * @see FileBackendStore::getDirectoryListInternal()
+        * @return Array|null
+        */
+       public function getDirectoryListInternal( $fullCont, $dirRel, array $params ) {
+               list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] );
+               $contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
+               $dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
+               $exists = is_dir( $dir );
+               if ( !$exists ) {
+                       wfDebug( __METHOD__ . "() given directory does not exist: '$dir'\n" );
+                       return array(); // nothing under this dir
+               } elseif ( !is_readable( $dir ) ) {
+                       wfDebug( __METHOD__ . "() given directory is unreadable: '$dir'\n" );
+                       return null; // bad permissions?
+               }
+               return new FSFileBackendDirList( $dir, $params );
+       }
+
        /**
         * @see FileBackendStore::getFileListInternal()
         * @return array|FSFileBackendFileList|null
@@ -451,13 +486,11 @@ class FSFileBackend extends FileBackendStore {
                if ( !$exists ) {
                        wfDebug( __METHOD__ . "() given directory does not exist: '$dir'\n" );
                        return array(); // nothing under this dir
-               }
-               $readable = is_readable( $dir );
-               if ( !$readable ) {
+               } elseif ( !is_readable( $dir ) ) {
                        wfDebug( __METHOD__ . "() given directory is unreadable: '$dir'\n" );
                        return null; // bad permissions?
                }
-               return new FSFileBackendFileList( $dir );
+               return new FSFileBackendFileList( $dir, $params );
        }
 
        /**
@@ -543,53 +576,65 @@ class FSFileBackend extends FileBackendStore {
 }
 
 /**
- * Wrapper around RecursiveDirectoryIterator that catches
- * exception or does any custom behavoir that we may want.
+ * Wrapper around RecursiveDirectoryIterator/DirectoryIterator that
+ * catches exception or does any custom behavoir that we may want.
  * Do not use this class from places outside FSFileBackend.
  *
  * @ingroup FileBackend
  */
-class FSFileBackendFileList implements Iterator {
-       /** @var RecursiveIteratorIterator */
+abstract class FSFileBackendList implements Iterator {
+       /** @var Iterator */
        protected $iter;
        protected $suffixStart; // integer
        protected $pos = 0; // integer
+       /** @var Array */
+       protected $params = array();
 
        /**
         * @param $dir string file system directory
         */
-       public function __construct( $dir ) {
+       public function __construct( $dir, array $params ) {
                $dir = realpath( $dir ); // normalize
                $this->suffixStart = strlen( $dir ) + 1; // size of "path/to/dir/"
+               $this->params = $params;
+
                try {
+                       $this->iter = $this->initIterator( $dir );
+               } catch ( UnexpectedValueException $e ) {
+                       $this->iter = null; // bad permissions? deleted?
+               }
+       }
+
+       /**
+        * Return an appropriate iterator object to wrap
+        *
+        * @param $dir string file system directory
+        * @return Iterator
+        */
+       protected function initIterator( $dir ) {
+               if ( !empty( $this->params['topOnly'] ) ) { // non-recursive
+                       # Get an iterator that will get direct sub-nodes
+                       return new DirectoryIterator( $dir );
+               } else { // recursive
                        # Get an iterator that will return leaf nodes (non-directories)
                        if ( MWInit::classExists( 'FilesystemIterator' ) ) { // PHP >= 5.3
                                # RecursiveDirectoryIterator extends FilesystemIterator.
                                # FilesystemIterator::SKIP_DOTS default is inconsistent in PHP 5.3.x.
-                               $flags = FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS;
-                               $this->iter = new RecursiveIteratorIterator( 
-                                       new RecursiveDirectoryIterator( $dir, $flags ) );
+                               $flags = FilesystemIterator::CURRENT_AS_SELF | FilesystemIterator::SKIP_DOTS;
+                               return new RecursiveIteratorIterator(
+                                       new RecursiveDirectoryIterator( $dir, $flags ),
+                                       RecursiveIteratorIterator::CHILD_FIRST // include dirs
+                               );
                        } else { // PHP < 5.3
                                # RecursiveDirectoryIterator extends DirectoryIterator
-                               $this->iter = new RecursiveIteratorIterator( 
-                                       new RecursiveDirectoryIterator( $dir ) );
+                               return new RecursiveIteratorIterator(
+                                       new RecursiveDirectoryIterator( $dir ),
+                                       RecursiveIteratorIterator::CHILD_FIRST // include dirs
+                               );
                        }
-               } catch ( UnexpectedValueException $e ) {
-                       $this->iter = null; // bad permissions? deleted?
                }
        }
 
-       /**
-        * @see Iterator::current()
-        * @return string|bool String or false
-        */
-       public function current() {
-               // Return only the relative path and normalize slashes to FileBackend-style
-               // Make sure to use the realpath since the suffix is based upon that
-               return str_replace( '\\', '/',
-                       substr( realpath( $this->iter->current() ), $this->suffixStart ) );
-       }
-
        /**
         * @see Iterator::key()
         * @return integer
@@ -598,6 +643,14 @@ class FSFileBackendFileList implements Iterator {
                return $this->pos;
        }
 
+       /**
+        * @see Iterator::current()
+        * @return string|bool String or false
+        */
+       public function current() {
+               return $this->getRelPath( $this->iter->current()->getPathname() );
+       }
+
        /**
         * @see Iterator::next()
         * @return void
@@ -605,6 +658,7 @@ class FSFileBackendFileList implements Iterator {
        public function next() {
                try {
                        $this->iter->next();
+                       $this->filterViaNext();
                } catch ( UnexpectedValueException $e ) {
                        $this->iter = null;
                }
@@ -619,6 +673,7 @@ class FSFileBackendFileList implements Iterator {
                $this->pos = 0;
                try {
                        $this->iter->rewind();
+                       $this->filterViaNext();
                } catch ( UnexpectedValueException $e ) {
                        $this->iter = null;
                }
@@ -631,4 +686,44 @@ class FSFileBackendFileList implements Iterator {
        public function valid() {
                return $this->iter && $this->iter->valid();
        }
+
+       /**
+        * Filter out items by advancing to the next ones
+        */
+       protected function filterViaNext() {}
+
+       /**
+        * Return only the relative path and normalize slashes to FileBackend-style.
+        * Uses the "real path" since the suffix is based upon that.
+        *
+        * @param $path string
+        * @return string
+        */
+       protected function getRelPath( $path ) {
+               return strtr( substr( realpath( $path ), $this->suffixStart ), '\\', '/' );
+       }
+}
+
+class FSFileBackendDirList extends FSFileBackendList {
+       protected function filterViaNext() {
+               while ( $this->iter->valid() ) {
+                       if ( $this->iter->current()->isDot() || !$this->iter->current()->isDir() ) {
+                               $this->iter->next(); // skip non-directories and dot files
+                       } else {
+                               break;
+                       }
+               }
+       }
+}
+
+class FSFileBackendFileList extends FSFileBackendList {
+       protected function filterViaNext() {
+               while ( $this->iter->valid() ) {
+                       if ( !$this->iter->current()->isFile() ) {
+                               $this->iter->next(); // skip non-files and dot files
+                       } else {
+                               break;
+                       }
+               }
+       }
 }
index b9821bf..f3b879a 100644 (file)
@@ -546,22 +546,89 @@ abstract class FileBackend {
        abstract public function getLocalCopy( array $params );
 
        /**
-        * Get an iterator to list out all stored files under a storage directory.
+        * Check if a directory exists at a given storage path.
+        * Backends using key/value stores will check if the path is a
+        * virtual directory, meaning there are files under the given directory.
+        *
+        * Storage backends with eventual consistency might return stale data.
+        *
+        * $params include:
+        *     dir : storage directory
+        *
+        * @return bool|null Returns null on failure
+        * @since 1.20
+        */
+       abstract public function directoryExists( array $params );
+
+       /**
+        * Get an iterator to list *all* directories under a storage directory.
+        * If the directory is of the form "mwstore://backend/container",
+        * then all directories in the container should be listed.
+        * If the directory is of form "mwstore://backend/container/dir",
+        * then all directories directly under that directory should be listed.
+        * Results should be storage directories relative to the given directory.
+        *
+        * Storage backends with eventual consistency might return stale data.
+        *
+        * $params include:
+        *     dir     : storage directory
+        *     topOnly : only return direct child directories of the directory
+        *
+        * @return Traversable|Array|null Returns null on failure
+        * @since 1.20
+        */
+       abstract public function getDirectoryList( array $params );
+
+       /**
+        * Same as FileBackend::getDirectoryList() except only lists
+        * directories that are immediately under the given directory.
+        *
+        * Storage backends with eventual consistency might return stale data.
+        *
+        * $params include:
+        *     dir : storage directory
+        *
+        * @return Traversable|Array|null Returns null on failure
+        * @since 1.20
+        */
+       final public function getTopDirectoryList( array $params ) {
+               return $this->getDirectoryList( array( 'topOnly' => true ) + $params );
+       }
+
+       /**
+        * Get an iterator to list *all* stored files under a storage directory.
         * If the directory is of the form "mwstore://backend/container",
         * then all files in the container should be listed.
         * If the directory is of form "mwstore://backend/container/dir",
-        * then all files under that container directory should be listed.
+        * then all files under that directory should be listed.
         * Results should be storage paths relative to the given directory.
         *
         * Storage backends with eventual consistency might return stale data.
         *
         * $params include:
-        *     dir : storage path directory
+        *     dir     : storage directory
+        *     topOnly : only return direct child files of the directory
         *
         * @return Traversable|Array|null Returns null on failure
         */
        abstract public function getFileList( array $params );
 
+       /**
+        * Same as FileBackend::getFileList() except only lists
+        * files that are immediately under the given directory.
+        *
+        * Storage backends with eventual consistency might return stale data.
+        *
+        * $params include:
+        *     dir : storage directory
+        *
+        * @return Traversable|Array|null Returns null on failure
+        * @since 1.20
+        */
+       final public function getTopFileList( array $params ) {
+               return $this->getFileList( array( 'topOnly' => true ) + $params );
+       }
+
        /**
         * Invalidate any in-process file existence and property cache.
         * If $paths is given, then only the cache for those files will be cleared.
@@ -708,6 +775,7 @@ abstract class FileBackend {
         *
         * @param $path string
         * @return bool
+        * @since 1.20
         */
        final public static function isPathTraversalFree( $path ) {
                return ( self::normalizeContainerPath( $path ) !== null );
index 1f084d1..208d34b 100644 (file)
@@ -84,8 +84,7 @@ class FileBackendMultiWrite extends FileBackend {
                $status = Status::newGood();
 
                $performOps = array(); // list of FileOp objects
-               $filesRead = array(); // storage paths read from
-               $filesChanged = array(); // storage paths written to
+               $paths = array(); // storage paths read from or written to
                // Build up a list of FileOps. The list will have all the ops
                // for one backend, then all the ops for the next, and so on.
                // These batches of ops are all part of a continuous array.
@@ -98,25 +97,18 @@ class FileBackendMultiWrite extends FileBackend {
                        if ( $index == 0 ) { // first batch
                                // Get the files used for these operations. Each backend has a batch of
                                // the same operations, so we only need to get them from the first batch.
-                               foreach ( $performOps as $fileOp ) {
-                                       $filesRead = array_merge( $filesRead, $fileOp->storagePathsRead() );
-                                       $filesChanged = array_merge( $filesChanged, $fileOp->storagePathsChanged() );
-                               }
+                               $paths = $backend->getPathsToLockForOpsInternal( $performOps );
                                // Get the paths under the proxy backend's name
-                               $filesRead = $this->unsubstPaths( $filesRead );
-                               $filesChanged = $this->unsubstPaths( $filesChanged );
+                               $paths['sh'] = $this->unsubstPaths( $paths['sh'] );
+                               $paths['ex'] = $this->unsubstPaths( $paths['ex'] );
                        }
                }
 
                // Try to lock those files for the scope of this function...
                if ( empty( $opts['nonLocking'] ) ) {
-                       $filesLockSh = array_diff( $filesRead, $filesChanged ); // optimization
-                       $filesLockEx = $filesChanged;
-                       // Get a shared lock on the parent directory of each path changed
-                       $filesLockSh = array_merge( $filesLockSh, array_map( 'dirname', $filesLockEx ) );
                        // Try to lock those files for the scope of this function...
-                       $scopeLockS = $this->getScopedFileLocks( $filesLockSh, LockManager::LOCK_UW, $status );
-                       $scopeLockE = $this->getScopedFileLocks( $filesLockEx, LockManager::LOCK_EX, $status );
+                       $scopeLockS = $this->getScopedFileLocks( $paths['sh'], LockManager::LOCK_UW, $status );
+                       $scopeLockE = $this->getScopedFileLocks( $paths['ex'], LockManager::LOCK_EX, $status );
                        if ( !$status->isOK() ) {
                                return $status; // abort
                        }
@@ -127,7 +119,7 @@ class FileBackendMultiWrite extends FileBackend {
 
                // Do a consistency check to see if the backends agree
                if ( count( $this->backends ) > 1 ) {
-                       $status->merge( $this->consistencyCheck( array_merge( $filesRead, $filesChanged ) ) );
+                       $status->merge( $this->consistencyCheck( array_merge( $paths['sh'], $paths['ex'] ) ) );
                        if ( !$status->isOK() ) {
                                return $status; // abort
                        }
@@ -321,7 +313,7 @@ class FileBackendMultiWrite extends FileBackend {
        }
 
        /**
-        * @see FileBackend::getFileList()
+        * @see FileBackend::concatenate()
         */
        public function concatenate( array $params ) {
                // We are writing to an FS file, so we don't need to do this per-backend
@@ -409,6 +401,22 @@ class FileBackendMultiWrite extends FileBackend {
                return $this->backends[$this->masterIndex]->getLocalCopy( $realParams );
        }
 
+       /**
+        * @see FileBackend::directoryExists()
+        */
+       public function directoryExists( array $params ) {
+               $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
+               return $this->backends[$this->masterIndex]->directoryExists( $realParams );
+       }
+
+       /**
+        * @see FileBackend::getSubdirectoryList()
+        */
+       public function getDirectoryList( array $params ) {
+               $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
+               return $this->backends[$this->masterIndex]->getDirectoryList( $realParams );
+       }
+
        /**
         * @see FileBackend::getFileList()
         */
index 57654e7..f7e4529 100644 (file)
@@ -646,7 +646,78 @@ abstract class FileBackendStore extends FileBackend {
        }
 
        /**
-        * @copydoc FileBackend::getFileList()
+        * @see FileBackend::directoryExists()
+        * @return bool|null
+        */
+       final public function directoryExists( array $params ) {
+               list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
+               if ( $dir === null ) {
+                       return false; // invalid storage path
+               }
+               if ( $shard !== null ) { // confined to a single container/shard
+                       return $this->doDirectoryExists( $fullCont, $dir, $params );
+               } else { // directory is on several shards
+                       wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
+                       list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+                       $res = false; // response
+                       foreach ( $this->getContainerSuffixes( $shortCont ) as $suffix ) {
+                               $exists = $this->doDirectoryExists( "{$fullCont}{$suffix}", $dir, $params );
+                               if ( $exists ) {
+                                       $res = true;
+                                       break; // found one!
+                               } elseif ( $exists === null ) { // error?
+                                       $res = null; // if we don't find anything, it is indeterminate
+                               }
+                       }
+                       return $res;
+               }
+       }
+
+       /**
+        * @see FileBackendStore::directoryExists()
+        *
+        * @param $container string Resolved container name
+        * @param $dir string Resolved path relative to container
+        * @param $params Array
+        * @return bool|null
+        */
+       abstract protected function doDirectoryExists( $container, $dir, array $params );
+
+       /**
+        * @see FileBackend::getDirectoryList()
+        * @return Array|null|Traversable
+        */
+       final public function getDirectoryList( array $params ) {
+               list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
+               if ( $dir === null ) { // invalid storage path
+                       return null;
+               }
+               if ( $shard !== null ) {
+                       // File listing is confined to a single container/shard
+                       return $this->getDirectoryListInternal( $fullCont, $dir, $params );
+               } else {
+                       wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
+                       // File listing spans multiple containers/shards
+                       list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
+                       return new FileBackendStoreShardDirIterator( $this,
+                               $fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params );
+               }
+       }
+
+       /**
+        * Do not call this function from places outside FileBackend
+        *
+        * @see FileBackendStore::getDirectoryList()
+        *
+        * @param $container string Resolved container name
+        * @param $dir string Resolved path relative to container
+        * @param $params Array
+        * @return Traversable|Array|null
+        */
+       abstract public function getDirectoryListInternal( $container, $dir, array $params );
+
+       /**
+        * @see FileBackend::getFileList()
         * @return Array|null|Traversable
         */
        final public function getFileList( array $params ) {
@@ -661,7 +732,7 @@ abstract class FileBackendStore extends FileBackend {
                        wfDebug( __METHOD__ . ": iterating over all container shards.\n" );
                        // File listing spans multiple containers/shards
                        list( $b, $shortCont, $r ) = self::splitStoragePath( $params['dir'] );
-                       return new FileBackendStoreShardListIterator( $this,
+                       return new FileBackendStoreShardFileIterator( $this,
                                $fullCont, $dir, $this->getContainerSuffixes( $shortCont ), $params );
                }
        }
@@ -726,6 +797,29 @@ abstract class FileBackendStore extends FileBackend {
                return $performOps;
        }
 
+       /**
+        * Get a list of storage paths to lock for a list of operations
+        * Returns an array with 'sh' (shared) and 'ex' (exclusive) keys,
+        * each corresponding to a list of storage paths to be locked.
+        *
+        * @param $performOps Array List of FileOp objects
+        * @return Array ('sh' => list of paths, 'ex' => list of paths)
+        */
+       final public function getPathsToLockForOpsInternal( array $performOps ) {
+               // Build up a list of files to lock...
+               $paths = array( 'sh' => array(), 'ex' => array() );
+               foreach ( $performOps as $fileOp ) {
+                       $paths['sh'] = array_merge( $paths['sh'], $fileOp->storagePathsRead() );
+                       $paths['ex'] = array_merge( $paths['ex'], $fileOp->storagePathsChanged() );
+               }
+               // Optimization: if doing an EX lock anyway, don't also set an SH one
+               $paths['sh'] = array_diff( $paths['sh'], $paths['ex'] );
+               // Get a shared lock on the parent directory of each path changed
+               $paths['sh'] = array_merge( $paths['sh'], array_map( 'dirname', $paths['ex'] ) );
+
+               return $paths;
+       }
+
        /**
         * @see FileBackend::doOperationsInternal()
         * @return Status
@@ -741,18 +835,10 @@ abstract class FileBackendStore extends FileBackend {
                // Acquire any locks as needed...
                if ( empty( $opts['nonLocking'] ) ) {
                        // Build up a list of files to lock...
-                       $filesLockEx = $filesLockSh = array();
-                       foreach ( $performOps as $fileOp ) {
-                               $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
-                               $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
-                       }
-                       // Optimization: if doing an EX lock anyway, don't also set an SH one
-                       $filesLockSh = array_diff( $filesLockSh, $filesLockEx );
-                       // Get a shared lock on the parent directory of each path changed
-                       $filesLockSh = array_merge( $filesLockSh, array_map( 'dirname', $filesLockEx ) );
+                       $paths = $this->getPathsToLockForOpsInternal( $performOps );
                        // Try to lock those files for the scope of this function...
-                       $scopeLockS = $this->getScopedFileLocks( $filesLockSh, LockManager::LOCK_UW, $status );
-                       $scopeLockE = $this->getScopedFileLocks( $filesLockEx, LockManager::LOCK_EX, $status );
+                       $scopeLockS = $this->getScopedFileLocks( $paths['sh'], LockManager::LOCK_UW, $status );
+                       $scopeLockE = $this->getScopedFileLocks( $paths['ex'], LockManager::LOCK_EX, $status );
                        if ( !$status->isOK() ) {
                                wfProfileOut( __METHOD__ . '-' . $this->name );
                                wfProfileOut( __METHOD__ );
@@ -962,6 +1048,19 @@ abstract class FileBackendStore extends FileBackend {
                return ''; // no sharding
        }
 
+       /**
+        * Check if a storage path maps to a single shard.
+        * Container dirs like "a", where the container shards on "x/xy",
+        * can reside on several shards. Such paths are tricky to handle.
+        *
+        * @param $storagePath string Storage path
+        * @return bool
+        */
+       final public function isSingleShardPathInternal( $storagePath ) {
+               list( $c, $r, $shard ) = $this->resolveStoragePath( $storagePath );
+               return ( $shard !== null );
+       }
+
        /**
         * Get the sharding config for a container.
         * If greater than 0, then all file storage paths within
@@ -1044,26 +1143,29 @@ abstract class FileBackendStore extends FileBackend {
 }
 
 /**
- * FileBackendStore helper function to handle file listings that span container shards.
+ * FileBackendStore helper function to handle listings that span container shards.
  * Do not use this class from places outside of FileBackendStore.
  *
  * @ingroup FileBackend
  */
-class FileBackendStoreShardListIterator implements Iterator {
-       /* @var FileBackendStore */
+abstract class FileBackendStoreShardListIterator implements Iterator {
+       /** @var FileBackendStore */
        protected $backend;
-       /* @var Array */
+       /** @var Array */
        protected $params;
-       /* @var Array */
+       /** @var Array */
        protected $shardSuffixes;
-       protected $container; // string
-       protected $directory; // string
+       protected $container; // string; full container name
+       protected $directory; // string; resolved relative path
 
-       /* @var Traversable */
+       /** @var Traversable */
        protected $iter;
        protected $curShard = 0; // integer
        protected $pos = 0; // integer
 
+       /** @var Array */
+       protected $multiShardPaths = array(); // (rel path => 1)
+
        /**
         * @param $backend FileBackendStore
         * @param $container string Full storage container name
@@ -1112,6 +1214,8 @@ class FileBackendStoreShardListIterator implements Iterator {
                } else {
                        $this->iter->next();
                }
+               // Filter out items that we already listed
+               $this->filterViaNext();
                // Find the next non-empty shard if no elements are left
                $this->nextShardIteratorIfNotValid();
        }
@@ -1124,6 +1228,8 @@ class FileBackendStoreShardListIterator implements Iterator {
                $this->pos = 0;
                $this->curShard = 0;
                $this->setIteratorFromCurrentShard();
+               // Filter out items that we already listed
+               $this->filterViaNext();
                // Find the next non-empty shard if this one has no elements
                $this->nextShardIteratorIfNotValid();
        }
@@ -1142,6 +1248,25 @@ class FileBackendStoreShardListIterator implements Iterator {
                }
        }
 
+       /**
+        * Filter out duplicate items by advancing to the next ones
+        */
+       protected function filterViaNext() {
+               while ( $this->iter->valid() ) {
+                       $rel = $this->iter->current(); // path relative to given directory
+                       $path = $this->params['dir'] . "/{$rel}"; // full storage path
+                       if ( !$this->backend->isSingleShardPathInternal( $path ) ) {
+                               // Don't keep listing paths that are on multiple shards
+                               if ( isset( $this->multiShardPaths[$rel] ) ) {
+                                       $this->iter->next(); // we already listed this path
+                               } else {
+                                       $this->multiShardPaths[$rel] = 1;
+                                       break;
+                               }
+                       }
+               }
+       }
+
        /**
         * If the list iterator for this container shard is out of items,
         * then move on to the next container that has items.
@@ -1161,7 +1286,35 @@ class FileBackendStoreShardListIterator implements Iterator {
         */
        protected function setIteratorFromCurrentShard() {
                $suffix = $this->shardSuffixes[$this->curShard];
-               $this->iter = $this->backend->getFileListInternal(
+               $this->iter = $this->listFromShard(
                        "{$this->container}{$suffix}", $this->directory, $this->params );
        }
+
+       /**
+        * Get the list for a given container shard
+        *
+        * @param $container string Resolved container name
+        * @param $dir string Resolved path relative to container
+        * @param $params Array
+        * @return Traversable|Array|null
+        */
+       abstract protected function listFromShard( $container, $dir, array $params );
+}
+
+/**
+ * Iterator for listing directories
+ */
+class FileBackendStoreShardDirIterator extends FileBackendStoreShardListIterator {
+       protected function listFromShard( $container, $dir, array $params ) {
+               return $this->backend->getDirectoryListInternal( $container, $dir, $params );
+       }
+}
+
+/**
+ * Iterator for listing regular files
+ */
+class FileBackendStoreShardFileIterator extends FileBackendStoreShardListIterator {
+       protected function listFromShard( $container, $dir, array $params ) {
+               return $this->backend->getFileListInternal( $container, $dir, $params );
+       }
 }
index c7e40e8..af5d693 100644 (file)
@@ -535,12 +535,39 @@ class SwiftFileBackend extends FileBackendStore {
                return $data;
        }
 
+       /**
+        * @see FileBackendStore::doDirectoryExists()
+        * @return bool|null
+        */
+       protected function doDirectoryExists( $fullCont, $dir, array $params ) {
+               try {
+                       $container = $this->getContainer( $fullCont );
+                       $prefix = ( $dir == '' ) ? null : "{$dir}/";
+                       return ( count( $container->list_objects( 1, null, $prefix ) ) > 0 );
+               } catch ( NoSuchContainerException $e ) {
+                       return false;
+               } catch ( InvalidResponseException $e ) {
+               } catch ( Exception $e ) { // some other exception?
+                       $this->logException( $e, __METHOD__, array( 'cont' => $fullCont, 'dir' => $dir ) );
+               }
+
+               return null; // error
+       }
+
+       /**
+        * @see FileBackendStore::getDirectoryListInternal()
+        * @return SwiftFileBackendDirList
+        */
+       public function getDirectoryListInternal( $fullCont, $dir, array $params ) {
+               return new SwiftFileBackendDirList( $this, $fullCont, $dir, $params );
+       }
+
        /**
         * @see FileBackendStore::getFileListInternal()
         * @return SwiftFileBackendFileList
         */
        public function getFileListInternal( $fullCont, $dir, array $params ) {
-               return new SwiftFileBackendFileList( $this, $fullCont, $dir );
+               return new SwiftFileBackendFileList( $this, $fullCont, $dir, $params );
        }
 
        /**
@@ -548,17 +575,96 @@ class SwiftFileBackend extends FileBackendStore {
         *
         * @param $fullCont string Resolved container name
         * @param $dir string Resolved storage directory with no trailing slash
-        * @param $after string Storage path of file to list items after
+        * @param $after string|null Storage path of file to list items after
         * @param $limit integer Max number of items to list
-        * @return Array
+        * @param $params Array Includes flag for 'topOnly'
+        * @return Array List of relative paths of dirs directly under $dir
         */
-       public function getFileListPageInternal( $fullCont, $dir, $after, $limit ) {
+       public function getDirListPageInternal( $fullCont, $dir, &$after, $limit, array $params ) {
+               $dirs = array();
+
+               try {
+                       $container = $this->getContainer( $fullCont );
+                       $prefix = ( $dir == '' ) ? null : "{$dir}/";
+                       // Non-recursive: only list dirs right under $dir
+                       if ( !empty( $params['topOnly'] ) ) {
+                               $objects = $container->list_objects( $limit, $after, $prefix, null, '/' );
+                               foreach ( $objects as $object ) { // files and dirs
+                                       if ( substr( $object, -1 ) === '/' ) {
+                                               $dirs[] = $object; // directories end in '/'
+                                       }
+                                       $after = $object; // update last item
+                               }
+                       // Recursive: list all dirs under $dir and its subdirs
+                       } else {
+                               // Get directory from last item of prior page
+                               $lastDir = $this->getParentDir( $after ); // must be first page
+                               $objects = $container->list_objects( $limit, $after, $prefix );
+                               foreach ( $objects as $object ) { // files
+                                       $objectDir = $this->getParentDir( $object ); // directory of object
+                                       if ( $objectDir !== false ) { // file has a parent dir
+                                               // Swift stores paths in UTF-8, using binary sorting.
+                                               // See function "create_container_table" in common/db.py.
+                                               // If a directory is not "greater" than the last one,
+                                               // then it was already listed by the calling iterator.
+                                               if ( $objectDir > $lastDir ) {
+                                                       $pDir = $objectDir;
+                                                       do { // add dir and all its parent dirs
+                                                               $dirs[] = "{$pDir}/";
+                                                               $pDir = $this->getParentDir( $pDir );
+                                                       } while ( $pDir !== false // sanity
+                                                               && $pDir > $lastDir // not done already
+                                                               && strlen( $pDir ) > strlen( $dir ) // within $dir
+                                                       );
+                                               }
+                                               $lastDir = $objectDir;
+                                       }
+                                       $after = $object; // update last item
+                               }
+                       }
+               } catch ( NoSuchContainerException $e ) {
+               } catch ( InvalidResponseException $e ) {
+               } catch ( Exception $e ) { // some other exception?
+                       $this->logException( $e, __METHOD__, array( 'cont' => $fullCont, 'dir' => $dir ) );
+               }
+
+               return $dirs;
+       }
+
+       protected function getParentDir( $path ) {
+               return ( strpos( $path, '/' ) !== false ) ? dirname( $path ) : false;
+       }
+
+       /**
+        * Do not call this function outside of SwiftFileBackendFileList
+        *
+        * @param $fullCont string Resolved container name
+        * @param $dir string Resolved storage directory with no trailing slash
+        * @param $after string|null Storage path of file to list items after
+        * @param $limit integer Max number of items to list
+        * @param $params Array Includes flag for 'topOnly'
+        * @return Array List of relative paths of files under $dir
+        */
+       public function getFileListPageInternal( $fullCont, $dir, &$after, $limit, array $params ) {
                $files = array();
 
                try {
                        $container = $this->getContainer( $fullCont );
                        $prefix = ( $dir == '' ) ? null : "{$dir}/";
-                       $files = $container->list_objects( $limit, $after, $prefix );
+                       // Non-recursive: only list files right under $dir
+                       if ( !empty( $params['topOnly'] ) ) { // files and dirs
+                               $objects = $container->list_objects( $limit, $after, $prefix, null, '/' );
+                               foreach ( $objects as $object ) {
+                                       if ( substr( $object, -1 ) !== '/' ) {
+                                               $files[] = $object; // directories end in '/'
+                                       }
+                               }
+                       // Recursive: list all files under $dir and its subdirs
+                       } else { // files
+                               $files = $container->list_objects( $limit, $after, $prefix );
+                       }
+                       $after = end( $files ); // update last item
+                       reset( $files ); // reset pointer
                } catch ( NoSuchContainerException $e ) {
                } catch ( InvalidResponseException $e ) {
                } catch ( Exception $e ) { // some other exception?
@@ -816,22 +922,24 @@ class SwiftFileBackend extends FileBackendStore {
 }
 
 /**
- * SwiftFileBackend helper class to page through object listings.
+ * SwiftFileBackend helper class to page through listings.
  * Swift also has a listing limit of 10,000 objects for sanity.
  * Do not use this class from places outside SwiftFileBackend.
  *
  * @ingroup FileBackend
  */
-class SwiftFileBackendFileList implements Iterator {
+abstract class SwiftFileBackendList implements Iterator {
        /** @var Array */
        protected $bufferIter = array();
        protected $bufferAfter = null; // string; list items *after* this path
        protected $pos = 0; // integer
+       /** @var Array */
+       protected $params = array();
 
        /** @var SwiftFileBackend */
        protected $backend;
-       protected $container; //
-       protected $dir; // string storage directory
+       protected $container; // string; container name
+       protected $dir; // string; storage directory
        protected $suffixStart; // integer
 
        const PAGE_SIZE = 5000; // file listing buffer size
@@ -840,8 +948,9 @@ class SwiftFileBackendFileList implements Iterator {
         * @param $backend SwiftFileBackend
         * @param $fullCont string Resolved container name
         * @param $dir string Resolved directory relative to container
+        * @param $params Array
         */
-       public function __construct( SwiftFileBackend $backend, $fullCont, $dir ) {
+       public function __construct( SwiftFileBackend $backend, $fullCont, $dir, array $params ) {
                $this->backend = $backend;
                $this->container = $fullCont;
                $this->dir = $dir;
@@ -853,14 +962,7 @@ class SwiftFileBackendFileList implements Iterator {
                } else { // dir within container
                        $this->suffixStart = strlen( $this->dir ) + 1; // size of "path/to/dir/"
                }
-       }
-
-       /**
-        * @see Iterator::current()
-        * @return string|bool String or false
-        */
-       public function current() {
-               return substr( current( $this->bufferIter ), $this->suffixStart );
+               $this->params = $params;
        }
 
        /**
@@ -882,10 +984,9 @@ class SwiftFileBackendFileList implements Iterator {
                // Check if there are no files left in this page and
                // advance to the next page if this page was not empty.
                if ( !$this->valid() && count( $this->bufferIter ) ) {
-                       $this->bufferAfter = end( $this->bufferIter );
-                       $this->bufferIter = $this->backend->getFileListPageInternal(
-                               $this->container, $this->dir, $this->bufferAfter, self::PAGE_SIZE
-                       );
+                       $this->bufferIter = $this->pageFromList(
+                               $this->container, $this->dir, $this->bufferAfter, self::PAGE_SIZE, $this->params
+                       ); // updates $this->bufferAfter
                }
        }
 
@@ -896,9 +997,9 @@ class SwiftFileBackendFileList implements Iterator {
        public function rewind() {
                $this->pos = 0;
                $this->bufferAfter = null;
-               $this->bufferIter = $this->backend->getFileListPageInternal(
-                       $this->container, $this->dir, $this->bufferAfter, self::PAGE_SIZE
-               );
+               $this->bufferIter = $this->pageFromList(
+                       $this->container, $this->dir, $this->bufferAfter, self::PAGE_SIZE, $this->params
+               ); // updates $this->bufferAfter
        }
 
        /**
@@ -908,4 +1009,58 @@ class SwiftFileBackendFileList implements Iterator {
        public function valid() {
                return ( current( $this->bufferIter ) !== false ); // no paths can have this value
        }
+
+       /**
+        * Get the given list portion (page)
+        *
+        * @param $container string Resolved container name
+        * @param $dir string Resolved path relative to container
+        * @param $after string|null
+        * @param $limit integer
+        * @param $params Array
+        * @return Traversable|Array|null
+        */
+       abstract protected function pageFromList( $container, $dir, &$after, $limit, array $params );
+}
+
+/**
+ * Iterator for listing directories
+ */
+class SwiftFileBackendDirList extends SwiftFileBackendList {
+       /**
+        * @see Iterator::current()
+        * @return string|bool String (relative path) or false
+        */
+       public function current() {
+               return substr( current( $this->bufferIter ), $this->suffixStart, -1 );
+       }
+
+       /**
+        * @see SwiftFileBackendList::pageFromList()
+        * @return Array
+        */
+       protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
+               return $this->backend->getDirListPageInternal( $container, $dir, $after, $limit, $params );
+       }
+}
+
+/**
+ * Iterator for listing regular files
+ */
+class SwiftFileBackendFileList extends SwiftFileBackendList {
+       /**
+        * @see Iterator::current()
+        * @return string|bool String (relative path) or false
+        */
+       public function current() {
+               return substr( current( $this->bufferIter ), $this->suffixStart );
+       }
+
+       /**
+        * @see SwiftFileBackendList::pageFromList()
+        * @return Array
+        */
+       protected function pageFromList( $container, $dir, &$after, $limit, array $params ) {
+               return $this->backend->getFileListPageInternal( $container, $dir, $after, $limit, $params );
+       }
 }
index ae11e67..461c255 100644 (file)
@@ -842,6 +842,13 @@ abstract class File {
                                }
                        }
 
+                       // If the backend is ready-only, don't keep generating thumbnails
+                       // only to return transformation errors, just return the error now.
+                       if ( $this->repo->getReadOnlyReason() !== false ) {
+                               $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
+                               break;
+                       }
+
                        // Create a temp FS file with the same extension and the thumbnail
                        $thumbExt = FileBackend::extensionFromPath( $thumbPath );
                        $tmpFile = TempFSFile::factory( 'transform_', $thumbExt );
index 9ae501a..8014413 100644 (file)
@@ -249,6 +249,6 @@ class ForeignAPIFile extends File {
                # Delete the thumbnails
                $this->repo->quickPurgeBatch( $purgeList );
                # Clear out the thumbnail directory if empty
-               $this->repo->cleanDir( $dir );
+               $this->repo->quickCleanDir( $dir );
        }
 }
index ffadca9..701a1ec 100644 (file)
@@ -779,7 +779,7 @@ class LocalFile extends File {
                # Delete the thumbnails
                $this->repo->quickPurgeBatch( $purgeList );
                # Clear out the thumbnail directory if empty
-               $this->repo->cleanDir( $dir );
+               $this->repo->quickCleanDir( $dir );
        }
 
        /** purgeDescription inherited */
index 20c8b95..56197ea 100644 (file)
@@ -188,7 +188,7 @@ class Parser {
        public function __construct( $conf = array() ) {
                $this->mConf = $conf;
                $this->mUrlProtocols = wfUrlProtocols();
-               $this->mExtLinkBracketedRegex = '/\[((' . wfUrlProtocols() . ')'.
+               $this->mExtLinkBracketedRegex = '/\[((' . $this->mUrlProtocols . ')'.
                        self::EXT_LINK_URL_CLASS.'+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
                if ( isset( $conf['preprocessorClass'] ) ) {
                        $this->mPreprocessorClass = $conf['preprocessorClass'];
@@ -1814,7 +1814,7 @@ class Parser {
                        # Don't allow internal links to pages containing
                        # PROTO: where PROTO is a valid URL protocol; these
                        # should be external links.
-                       if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $m[1] ) ) {
+                       if ( preg_match( '/^(?:' . $this->mUrlProtocols . ')/', $m[1] ) ) {
                                $s .= $prefix . '[[' . $line ;
                                wfProfileOut( __METHOD__."-misc" );
                                continue;
@@ -2051,7 +2051,7 @@ class Parser {
         * @return String: less-or-more HTML with NOPARSE bits
         */
        function armorLinks( $text ) {
-               return preg_replace( '/\b(' . wfUrlProtocols() . ')/',
+               return preg_replace( '/\b(' . $this->mUrlProtocols . ')/',
                        "{$this->mUniqPrefix}NOPARSE$1", $text );
        }
 
@@ -5573,7 +5573,7 @@ class Parser {
                # @todo FIXME: Not tolerant to blank link text
                # I.E. [http://www.mediawiki.org] will render as [1] or something depending
                # on how many empty links there are on the page - need to figure that out.
-               $text = preg_replace( '/\[(?:' . wfUrlProtocols() . ')([^ ]+?) ([^[]+)\]/', '$2', $text );
+               $text = preg_replace( '/\[(?:' . $this->mUrlProtocols . ')([^ ]+?) ([^[]+)\]/', '$2', $text );
 
                # Parse wikitext quotes (italics & bold)
                $text = $this->doQuotes( $text );
index 0307e7d..cbb5f01 100644 (file)
@@ -3169,6 +3169,7 @@ $4-এ নিশ্চিতকরণ কোডটি মেয়াদোত
 'feedback-error1' => 'ত্রুটি: এপিআই থেকে অজানা ফলাফল এসেছে',
 'feedback-error2' => 'ত্রুটি: সম্পাদনা ব্যর্থ',
 'feedback-error3' => 'ত্রুটি: এপিআই থেকে কোন সাড়া নেই',
+'feedback-close' => 'সম্পন্ন',
 
 # API errors
 'api-error-badaccess-groups' => 'আপনার এই উইকিতে ফাইল আপলোডের অনুমতি নেই।',
@@ -3206,4 +3207,15 @@ $4-এ নিশ্চিতকরণ কোডটি মেয়াদোত
 'api-error-uploaddisabled' => 'এই উইকির জন্য আপলোড সুবিধা নিস্ক্রিয় রয়েছে।',
 'api-error-verification-error' => 'সম্ভবত এই ফাইলটি ত্রুটিপূর্ণ অথবা এর এক্সটেনশনটি ভুল।',
 
+# Durations
+'duration-seconds' => '$1 {{PLURAL:$1|সেকেন্ড|সেকেন্ড}}',
+'duration-minutes' => '$1 {{PLURAL:$1|মিনিট|মিনিট}}',
+'duration-hours' => '$1 {{PLURAL:$1|ঘন্টা|ঘন্টা}}',
+'duration-days' => '$1 {{PLURAL:$1|দিন|দিন}}',
+'duration-weeks' => '{{PLURAL: $1|সপ্তাহ|সপ্তাহ}}',
+'duration-years' => '$1 {{PLURAL:$1|বছর|বছর}}',
+'duration-decades' => '$1 {{PLURAL:$1|দশক|দশক}}',
+'duration-centuries' => '$1 {{PLURAL:$1|শতাব্দী|শতাব্দী}}',
+'duration-millennia' => '$1 {{PLURAL:$1|সহস্রাব্দ|সহস্রাব্দ}}',
+
 );
index c9b245b..f55e957 100644 (file)
@@ -1023,6 +1023,7 @@ Zde je pro přehled zobrazen nejnovější záznam z knihy zablokování:',
 'note' => "'''Poznámka:'''&nbsp;",
 'previewnote' => "'''Pamatujte, že toto je pouze náhled.'''
 Změny zatím nebyly uloženy!",
+'continue-editing' => 'Pokračovat v editaci',
 'previewconflict' => 'Tento náhled ukazuje text tak, jak bude vypadat po uložení stránky.',
 'session_fail_preview' => "'''Váš požadavek se nepodařilo zpracovat kvůli ztrátě dat z relace.
 Zkuste to prosím znovu.
@@ -3823,6 +3824,9 @@ MediaWiki je distribuována v naději, že bude užitečná, avšak BEZ JAKÉKOL
 'version-software' => 'Nainstalovaný software',
 'version-software-product' => 'Název',
 'version-software-version' => 'Verze',
+'version-entrypoints' => 'URL vstupních bodů',
+'version-entrypoints-header-entrypoint' => 'Vstupní bod',
+'version-entrypoints-header-url' => 'URL',
 
 # Special:FilePath
 'filepath' => 'Cesta k souboru',
index 8cd0dc0..b330567 100644 (file)
@@ -859,6 +859,7 @@ Loggen over den seneste blokering ses nedenfor:',
 'note' => "'''Bemærk:'''",
 'previewnote' => "'''Husk at dette er kun en forhåndsvisning.'''
 Dine ændringer er endnu ikke blevet gemt!",
+'continue-editing' => 'Fortsæt med at redigere',
 'previewconflict' => 'Denne forhåndsvisning er resultatet af den redigérbare tekst ovenfor, sådan vil det komme til at se ud hvis du vælger at gemme teksten.',
 'session_fail_preview' => "'''Din ændring kunne ikke gemmes, da dine sessionsdata er gået tabt.
 Prøv venligst igen. Hvis problemet fortsætter, log af og log på igen.'''",
index a1cb4bd..b9e10e6 100644 (file)
@@ -811,6 +811,7 @@ Nejnowšy zapisk blokěrowańskego protokola pódawa se dołojce ako referenca:'
 'note' => "'''Pokazka:'''",
 'previewnote' => "'''Wobmysli, až to jo jano pśeglěd.'''
 Twóje změny hyšći njejsu składowane!",
+'continue-editing' => 'Dalej wobźěłaś',
 'previewconflict' => 'Toś ten pśeglěd wótbłyšćujo tekst górjejcnego póla. Bok buźo tak wuglědaś, jolic jen něnto składujoš.',
 'session_fail_preview' => "'''Wódaj! Twójo wobźěłanje njejo se mógało składowaś, dokulaž su daty twójogo pósejźenja se zgubili. Pšosym wopytaj hyšći raz. Jolic až to pón pśecej hyšći njejźo, wopytaj se wótzjawiś a zasej pśizjawiś.'''",
 'session_fail_preview_html' => "'''Wódaj! Twójo wobźěłanje njejo se mógało składowaś, dokulaž su daty twójogo pósejźenja se zgubili.'''
index 7ac9383..7fe16dc 100644 (file)
@@ -1026,6 +1026,7 @@ La última entrada del registro de bloqueos se proporciona debajo para mayor ref
 'note' => "'''Nota:'''",
 'previewnote' => "'''¡Recuerda que esto es solo una previsualización.'''
 ¡Tus cambios aún no se ha guardado!",
+'continue-editing' => 'Continuar editando',
 'previewconflict' => 'Esta previsualización refleja el texto en el área de edición superior como aparecerá una vez guardados los cambios.',
 'session_fail_preview' => "'''Lo sentimos, no pudimos procesar la edición debido a una pérdida de los datos de sesión.'''
 Por favor, inténtalo de nuevo.
index c7e1b03..59bf42c 100644 (file)
@@ -961,7 +961,8 @@ Alla on viimeisin estolokin tapahtuma:',
 'userinvalidcssjstitle' => "'''Varoitus:''' Tyyliä nimeltä ”$1” ei ole olemassa. Muista, että käyttäjän määrittelemät .css- ja .js-sivut alkavat pienellä alkukirjaimella, esim. {{ns:user}}:Matti Meikäläinen/vector.css eikä {{ns:user}}:Matti Meikäläinen/Vector.css.",
 'updated' => '(Päivitetty)',
 'note' => "'''Huomautus:'''",
-'previewnote' => "'''Tämä on vasta sivun esikatselu. Sivua ei ole vielä tallennettu!'''",
+'previewnote' => "'''Tämä on vasta sivun esikatselu. Tekemiäsi muokkauksia ei ole vielä tallennettu!'''",
+'continue-editing' => 'Jatka muokkaamista',
 'previewconflict' => 'Tämä esikatselu näyttää miltä muokkausalueella oleva teksti näyttää tallennettuna.',
 'session_fail_preview' => "'''Muokkaustasi ei voitu tallentaa, koska istuntosi tiedot ovat kadonneet.''' Yritä uudelleen. Jos ongelma ei katoa, yritä [[Special:UserLogout|kirjautua ulos]] ja takaisin sisään.",
 'session_fail_preview_html' => "'''Muokkaustasi ei voitu tallentaa, koska istuntosi tiedot ovat kadonneet.'''
@@ -972,6 +973,7 @@ Yritä uudelleen. Jos ongelma ei katoa, yritä [[Special:UserLogout|kirjautua ul
 'token_suffix_mismatch' => "'''Muokkauksesi on hylätty, koska asiakasohjelmasi ei osaa käsitellä välimerkkejä muokkaustarkisteessa. Syynä voi olla viallinen välityspalvelin.'''",
 'edit_form_incomplete' => "'''Osa muokkauslomakkeesta ei saavuttanut palvelinta. Tarkista, että muokkauksesi ovat vahingoittumattomia ja yritä uudelleen.'''",
 'editing' => 'Muokataan sivua $1',
+'creating' => 'Luodaan sivu $1',
 'editingsection' => 'Muokataan osiota sivusta $1',
 'editingcomment' => 'Muokataan uutta osiota sivulla $1',
 'editconflict' => 'Päällekkäinen muokkaus: $1',
@@ -987,7 +989,7 @@ Sinun täytyy yhdistää muutoksesi olemassa olevaan tekstiin.
 'yourdiff' => 'Eroavaisuudet',
 'copyrightwarning' => "'''Muutoksesi astuvat voimaan välittömästi.''' Kaikki {{GRAMMAR:illative|{{SITENAME}}}} tehtävät tuotokset katsotaan julkaistuksi $2 -lisenssin mukaisesti ($1). Jos et halua, että kirjoitustasi muokataan armottomasti ja uudelleenkäytetään vapaasti, älä tallenna kirjoitustasi. Tallentamalla muutoksesi lupaat, että kirjoitit tekstisi itse, tai kopioit sen jostain vapaasta lähteestä. '''ÄLÄ KÄYTÄ TEKIJÄNOIKEUDEN ALAISTA MATERIAALIA ILMAN LUPAA!'''",
 'copyrightwarning2' => "Huomaa, että kuka tahansa voi muokata, muuttaa ja poistaa kaikkia sivustolle tekemiäsi lisäyksiä ja muutoksia. Muokkaamalla sivustoa luovutat sivuston käyttäjille tämän oikeuden ja takaat, että lisäämäsi aineisto on joko itse kirjoittamaasi tai peräisin jostain vapaasta lähteestä. Lisätietoja sivulla $1. '''TEKIJÄNOIKEUDEN ALAISEN MATERIAALIN KÄYTTÄMINEN ILMAN LUPAA ON EHDOTTOMASTI KIELLETTYÄ!'''",
-'longpageerror' => "'''Sivun koko on $1 binäärikilotavua. Sivua ei voida tallentaa, koska enimmäiskoko on $2 binäärikilotavua.'''",
+'longpageerror' => "'''Virhe: Lähettämäsi tekstin pituus on {{PLURAL:$1|kilotavu|$1 kilotavua}}. Tekstiä ei voida tallentaa, koska se on pitempi kuin sallittu {{PLURAL:$2|yksi kilotavu|$2 kilotavua}}.'''",
 'readonlywarning' => "'''Varoitus: Tietokanta on lukittu huoltoa varten, joten et pysty tallentamaan muokkauksiasi juuri nyt.'''
 Saattaa olla paras leikata ja liimata tekstisi omaan tekstitiedostoosi ja tallentaa se tänne myöhemmin.
 
@@ -1026,6 +1028,7 @@ Se on ilmeisesti poistettu.',
 'edit-no-change' => 'Muokkauksesi sivuutettiin, koska tekstiin ei tehty mitään muutoksia.',
 'edit-already-exists' => 'Uuden sivun luominen ei onnistunut.
 Se on jo olemassa.',
+'defaultmessagetext' => 'Viestin oletusteksti',
 
 # Parser/template warnings
 'expensive-parserfunction-warning' => 'Tällä sivulla on liian monta hitaiden laajennusfunktioiden kutsua.
@@ -1598,6 +1601,7 @@ Tässä satunnaisesti tuotettu arvo, jota voit käyttää: $1',
 'newsectionsummary' => '/* $1 */ uusi osio',
 'rc-enhanced-expand' => 'Näytä yksityiskohdat (JavaScript)',
 'rc-enhanced-hide' => 'Piilota yksityiskohdat',
+'rc-old-title' => 'alun perin luotu nimellä "$1"',
 
 # Recent changes linked
 'recentchangeslinked' => 'Linkitettyjen sivujen muutokset',
@@ -2085,6 +2089,7 @@ Voit rajoittaa listaa valitsemalla lokityypin, käyttäjän tai sivun johon muut
 'allpagesprefix' => 'Katkaisuhaku',
 'allpagesbadtitle' => 'Annettu otsikko oli kelvoton tai siinä oli wikien välinen etuliite.',
 'allpages-bad-ns' => '{{GRAMMAR:inessive|{{SITENAME}}}} ei ole nimiavaruutta ”$1”.',
+'allpages-hide-redirects' => 'Piilota uudelleenohjaukset',
 
 # Special:Categories
 'categories' => 'Luokat',
@@ -2558,7 +2563,7 @@ Alla on ote estolokista.',
 Alla on ote häivytyslokista.',
 'blocklogentry' => 'esti käyttäjän tai IP-osoitteen [[$1]]. Eston kesto $2 $3',
 'reblock-logentry' => 'muutti käyttäjän tai IP-osoitteen [[$1]] eston asetuksia. Eston kesto $2 $3',
-'blocklogtext' => 'Tämä on loki muokkausestoista ja niiden purkamisista. Automaattisesti estettyjä IP-osoitteita ei kirjata. Tutustu [[Special:BlockList|estolistaan]] nähdäksesi listan tällä hetkellä voimassa olevista estoista.',
+'blocklogtext' => 'Tämä on loki muokkausestoista ja niiden purkamisista. Automaattisesti estettyjä IP-osoitteita ei kirjata. Tutustu [[Special:BlockList|estolistaan]] nähdäksesi luettelon tällä hetkellä voimassa olevista estoista.',
 'unblocklogentry' => 'poisti käyttäjältä $1 muokkauseston',
 'block-log-flags-anononly' => 'vain kirjautumattomat käyttäjät estetty',
 'block-log-flags-nocreate' => 'tunnusten luonti estetty',
@@ -2797,7 +2802,7 @@ Tallenna tiedot koneellesi ja tuo ne tällä sivulla.',
 
 # JavaScriptTest
 'javascripttest' => 'JavaScriptin testaus',
-'javascripttest-disabled' => 'Tämä toiminto ei ole käytössä.',
+'javascripttest-disabled' => 'Tämä toiminto ei ole käytössä tässä wikissä.',
 'javascripttest-title' => 'Suoritetaan $1-testejä.',
 'javascripttest-pagetext-noframework' => 'Tämä sivu on varattu JavaScript-testien suorittamiseen.',
 'javascripttest-pagetext-unknownframework' => 'Tuntematon testausalusta $1.',
@@ -3823,4 +3828,15 @@ Muussa tapauksessa voit käyttää alla olevaa helpompaa lomaketta. Kommenttisi
 'api-error-uploaddisabled' => 'Tiedostojen tallentaminen ei ole käytössä.',
 'api-error-verification-error' => 'Tiedosto voi olla vioittunut, tai sillä saattaa olla väärä tiedostopääte.',
 
+# Durations
+'duration-seconds' => '$1 {{PLURAL:$1|sekunti|sekuntia}}',
+'duration-minutes' => '$1 {{PLURAL:$1|minuutti|minuuttia}}',
+'duration-hours' => '$1 {{PLURAL:$1|tunti|tuntia}}',
+'duration-days' => '$1 {{PLURAL:$1|päivä|päivää}}',
+'duration-weeks' => '$1 {{PLURAL:$1|viikko|viikkoa}}',
+'duration-years' => '$1 {{PLURAL:$1|vuosi|vuotta}}',
+'duration-decades' => '$1 {{PLURAL:$1|vuosikymmen|vuosikymmentä}}',
+'duration-centuries' => '$1 {{PLURAL:$1|vuosisata|vuosisataa}}',
+'duration-millennia' => '$1 {{PLURAL:$1|vuosituhat|vuosituhatta}}',
+
 );
index 7a99e56..e9d6334 100644 (file)
@@ -1031,6 +1031,7 @@ La dernière entrée du registre des blocages est indiquée ci-dessous à titre
 'note' => "'''Note :'''",
 'previewnote' => "'''Rappelez-vous que ce n’est qu’une prévisualisation.'''
 Vos modifications n’ont pas encore été enregistrées !",
+'continue-editing' => 'Continuer la modification',
 'previewconflict' => 'Cette prévisualisation montre le texte de la boîte supérieure de modification tel qu’il apparaîtra si vous choisissez de le publier.',
 'session_fail_preview' => "'''Nous ne pouvons enregistrer votre modification à cause d’une perte d’informations concernant votre session.'''
 Veuillez réessayer.
index 5aae82b..9ce0b51 100644 (file)
@@ -1042,6 +1042,7 @@ $2
 'note' => "'''הערה:'''",
 'previewnote' => "'''זכרו שזו רק תצוגה מקדימה.'''
 השינויים שלכם טרם נשמרו!",
+'continue-editing' => 'להמשך העריכה',
 'previewconflict' => 'תצוגה מקדימה זו מציגה כיצד ייראה הטקסט בחלון העריכה העליון, אם תבחרו לשמור אותו.',
 'session_fail_preview' => "'''לא ניתן לבצע את עריכתכם עקב אובדן מידע הכניסה.'''
 אנא נסו שוב.
index 2f42f37..8bc8040 100644 (file)
@@ -804,6 +804,7 @@ Móžeš [[Special:Search/{{PAGENAME}}|tutón titul strony]] na druhich stronach
 'note' => "'''Kedźbu:'''",
 'previewnote' => "'''Wobmysl, zo to je jenož přehlad.'''
 Twoje změny hišće njejsu składowane!",
+'continue-editing' => 'Dale wobdźěłać',
 'previewconflict' => 'Tutón přehlad zwobraznja tekst w hornim tekstowym polu,  kaž so zjewi, jeli jón składuješ.',
 'session_fail_preview' => "'''Njemóžachmy twoju změnu předźěłać, dokelž su so posedźenske daty zhubili.'''
 Spytaj prošu hišće raz.
index dcbbe03..9bec9ac 100644 (file)
@@ -9,6 +9,7 @@
  *
  * @author Akaniji
  * @author Alexsh
+ * @author Ant176
  * @author Aotake
  * @author Aphaia
  * @author Broad-Sky
@@ -640,7 +641,7 @@ $1',
 'collapsible-collapse' => '折り畳む',
 'collapsible-expand' => '展開する',
 'thisisdeleted' => '$1を閲覧または復帰しますか?',
-'viewdeleted' => '$1を表示しますか?',
+'viewdeleted' => '$1を閲覧しますか?',
 'restorelink' => '削除された$1編集',
 'feedlinks' => 'フィード:',
 'feed-invalid' => 'フィード形式の指定が間違っています。',
@@ -771,7 +772,7 @@ $2',
 'yourname' => '利用者名:',
 'yourpassword' => 'パスワード:',
 'yourpasswordagain' => 'パスワード再入力:',
-'remembermypassword' => 'このブラウザーにログイン情報を保存 (最長{{PLURAL:$1|日|日間}})',
+'remembermypassword' => 'このブラウザーにログイン情報を保存 (最長 $1 {{PLURAL:$1|日|日間}})',
 'securelogin-stick-https' => 'ログイン後にHTTPS接続を維持',
 'yourdomainname' => 'ドメイン:',
 'externaldberror' => '外部の認証データベースでエラーが発生したか、または外部アカウント情報の更新が許可されていません。',
@@ -1064,7 +1065,8 @@ IP アドレスは複数の利用者で共有されている場合がありま
 'updated' => '(更新)',
 'note' => "'''お知らせ:'''",
 'previewnote' => "'''これはプレビューです。'''
-変更箇所はまだ保存されていません",
+変更箇所はまだ保存されていません!",
+'continue-editing' => '編集を続行',
 'previewconflict' => 'このプレビューは、上の文章編集エリアの文章を保存した場合にどう見えるようになるかを示すものです。',
 'session_fail_preview' => "'''申し訳ありません!セッションデータが消失したため編集を処理できませんでした。'''
 もう一度やり直してください。
@@ -1139,7 +1141,7 @@ IP アドレスは複数の利用者で共有されている場合がありま
 参考のため以下にこのページの削除と移動の記録を表示します:",
 'moveddeleted-notice' => 'このページは削除されています。
 参考のため、このページの削除と移動の記録を以下に表示します。',
-'log-fulllog' => '完全な記録を見る',
+'log-fulllog' => '完全な記録を閲覧',
 'edit-hook-aborted' => 'フックによって編集が破棄されました。
 理由は不明です。',
 'edit-gone-missing' => 'ページを更新できませんでした。
@@ -1179,7 +1181,7 @@ IP アドレスは複数の利用者で共有されている場合がありま
 $3が示した理由は ''$2'' です。",
 
 # History pages
-'viewpagelogs' => 'このページに関する記録を表示',
+'viewpagelogs' => 'このページに関する記録を閲覧',
 'nohistory' => 'このページには編集履歴がありません。',
 'currentrev' => '最新版',
 'currentrev-asof' => '$1時点における最新版',
@@ -3064,7 +3066,7 @@ MediaWiki 全般のローカライズ(地域化)に貢献したい場合は
 'tooltip-pt-login' => 'ログインすることが推奨されます。ただし、必須ではありません。',
 'tooltip-pt-anonlogin' => 'ログインすることが推奨されます。ただし、必須ではありません。',
 'tooltip-pt-logout' => 'ログアウト',
-'tooltip-ca-talk' => '記事についての議論',
+'tooltip-ca-talk' => '本文ページについての議論',
 'tooltip-ca-edit' => 'このページを編集できます。保存する前にプレビューボタンを使用してください。',
 'tooltip-ca-addsection' => '新しい節を開始する',
 'tooltip-ca-viewsource' => 'このページは保護されています。
@@ -3098,7 +3100,7 @@ MediaWiki 全般のローカライズ(地域化)に貢献したい場合は
 'tooltip-t-specialpages' => '特別ページの一覧',
 'tooltip-t-print' => 'このページの印刷用ページ',
 'tooltip-t-permalink' => 'このページのこの版への固定リンク',
-'tooltip-ca-nstab-main' => '本文を表示',
+'tooltip-ca-nstab-main' => '本文を閲覧',
 'tooltip-ca-nstab-user' => '利用者ページを表示',
 'tooltip-ca-nstab-media' => 'メディアページを表示',
 'tooltip-ca-nstab-special' => 'これは特別ページです。編集することはできません。',
@@ -3107,7 +3109,7 @@ MediaWiki 全般のローカライズ(地域化)に貢献したい場合は
 'tooltip-ca-nstab-mediawiki' => 'システムメッセージを表示',
 'tooltip-ca-nstab-template' => 'テンプレートを表示',
 'tooltip-ca-nstab-help' => 'ヘルプページを表示',
-'tooltip-ca-nstab-category' => 'カテゴリページを表示',
+'tooltip-ca-nstab-category' => 'カテゴリページを閲覧',
 'tooltip-minoredit' => 'この編集を細部の変更とマーク',
 'tooltip-save' => '変更を保存',
 'tooltip-preview' => '変更をプレビューで確認できます。保存前に使用してください!',
index e816497..0a317eb 100644 (file)
@@ -839,6 +839,7 @@ $2
 'note' => "'''შენიშვნა:'''",
 'previewnote' => "'''დაიმახსოვრეთ, ეს მხოლოდ წინასწარი გადახედვაა.'''
 თქვენი ცვლილებები ჯერ არ შენახულა!",
+'continue-editing' => 'რედაქტირების გაგრძელება',
 'previewconflict' => 'შავი ნიმუში უჩვენებს ტექსტს ზედა რედაქტირების ფანჯარაში, როგორც ის გამოჩნდება თუ თქვენ მას შეინახავთ.',
 'session_fail_preview' => "'''უკაცრავად! ვერ შევძელით თქვენი რედაქტირების შენახვა სესიის მონაცემთა დაკარგვის გამო.
 გთხოვთ ისევ სცადოთ.
index 7a264ca..7b13bfd 100644 (file)
@@ -835,6 +835,7 @@ Denkt drun datt eegen .css an .js Säiten e kleng geschriwwenen Titel benotzen,
 'note' => "'''Notiz:'''",
 'previewnote' => "'''Denkt drun datt dëst nëmmen eng net gespäichert Versioun ass.'''
 Är Ännerunge sinn nach net gespäichert!",
+'continue-editing' => 'Weider änneren',
 'previewconflict' => 'Dir gesitt an dem ieweschten Textfeld wéi den Text ausgesi wäert, wann Dir späichert.',
 'session_fail_preview' => "'''Är Ännerung konnt net gespäichert gi well d'Date vun Ärer Sessioun verluergaange sinn.
 Versicht et w.e.g. nach eng Kéier.
@@ -1903,6 +1904,7 @@ An all Rei sti Linken zur éischter an zweeter Viruleedung, souwéi d\'Zil vun d
 'wantedpages' => 'Gewënschte Säiten',
 'wantedpages-badtitle' => 'Net valabelen Titel am Resultat: $1',
 'wantedfiles' => 'Gewënschte Fichieren',
+'wantedfiletext-cat' => 'Dës Fichiere gi benotzt awer et gëtt se net. Fichiere aus frieme Repositorie kënnen hei gewise ginn och wann et se gëtt. All esou falsch Positiver ginn <del>duerchgestrach</del>. Zousätzlech gi Säiten an deene Fichieren dra sinn déi et net gëtt op [[:$1]] gewisen.',
 'wantedtemplates' => 'Gewënschte Schablounen',
 'mostlinked' => 'Dacks verlinkte Säiten',
 'mostlinkedcategories' => 'Dacks benotzte Kategorien',
index 3573202..e6ca5e3 100644 (file)
@@ -1025,6 +1025,7 @@ $2
 'note' => "'''Напомена:'''",
 'previewnote' => "'''Имајте предвид дека ова е само преглед.'''
 Вашите промени сè уште не се зачувани!",
+'continue-editing' => 'Продолжете со уредување',
 'previewconflict' => 'Овој преглед прикажува како ќе изгледа текстот внесен во горниот дел откако ќе се зачува страницата.',
 'session_fail_preview' => "'''Жалиме! Не можевме да го обработиме вашето уредување поради загуба на сесиски податоци.'''
 Обидете се повторно.
index e9caaf1..6a988b5 100644 (file)
@@ -980,6 +980,7 @@ $1 ആണ് ഈ തടയൽ നടത്തിയത്. ''$2'' എന്ന
 'note' => "'''പ്രത്യേക ശ്രദ്ധയ്ക്ക്:'''",
 'previewnote' => "'''ഇതൊരു പ്രിവ്യൂ മാത്രമാണെന്ന് ഓർക്കുക.'''
 താങ്കൾ വരുത്തിയ മാറ്റങ്ങൾ ഇതുവരെ സേവ് ചെയ്തിട്ടില്ല!",
+'continue-editing' => 'തിരുത്തൽ തുടരുക',
 'previewconflict' => 'ഈ പ്രിവ്യൂവിൽ മുകളിലെ ടെക്സ്റ്റ് ഏരിയയിലുള്ള എഴുത്ത് മാത്രമാണ് കാട്ടുന്നത്, സേവ്‌ ചെയ്യാൻ താങ്കൾ തീരുമാനിച്ചാൽ അത് സേവ് ആകുന്നതാണ്.',
 'session_fail_preview' => "'''ക്ഷമിക്കണം! സെഷൻ ഡാറ്റ നഷ്ടപ്പെട്ടതിനാൽ താങ്കളുടെ തിരുത്തലിന്റെ തുടർപ്രക്രിയ നടത്തുവാൻ സാധിച്ചില്ല.''' 
 ദയവായി വീണ്ടും ശ്രമിക്കൂ.
@@ -2252,7 +2253,7 @@ https://www.mediawiki.org/wiki/Manual:Image_Authorization കാണുക.',
 'notanarticle' => 'ലേഖന താൾ അല്ല',
 'notvisiblerev' => 'മറ്റൊരു ഉപയോക്താവ് സൃഷ്ടിച്ച അവസാനത്തെ നാൾപ്പതിപ്പ് മായ്ച്ചിരിക്കുന്നു',
 'watchnochange' => 'താങ്കൾ ശ്രദ്ധിക്കുന്ന താളുകൾ ഒന്നും തന്നെ ഇക്കാലയളവിൽ തിരുത്തപ്പെട്ടിട്ടില്ല.',
-'watchlist-details' => 'à´¸à´\82â\80\8cവാദà´\82 à´¤à´¾à´³àµ\81à´\95ൾ à´\85à´²àµ\8dലാതàµ\8dà´¤ {{PLURAL:$1|ഒരു താൾ|$1 താളുകൾ}} താങ്കൾ ശ്രദ്ധിക്കുന്നവയുടെ പട്ടികയിലുണ്ട്.',
+'watchlist-details' => 'à´¸à´\82â\80\8cവാദà´\82 à´¤à´¾à´³àµ\81à´\95ൾ à´\89ൾപàµ\8dà´ªàµ\86à´\9fàµ\81à´¤àµ\8dതാതàµ\86 {{PLURAL:$1|ഒരു താൾ|$1 താളുകൾ}} താങ്കൾ ശ്രദ്ധിക്കുന്നവയുടെ പട്ടികയിലുണ്ട്.',
 'wlheader-enotif' => '* ഇമെയിൽ വിജ്ഞാപനം സാധ്യമാക്കിയിരിക്കുന്നു.',
 'wlheader-showupdated' => "* താങ്കളുടെ അവസാന സന്ദർശനത്തിനു ശേഷം തിരുത്തപ്പെട്ട താളുകൾ  '''കടുപ്പിച്ച്''' കാണിച്ചിരിക്കുന്നു",
 'watchmethod-recent' => 'ശ്രദ്ധിക്കുന്ന താളുകൾക്കുവേണ്ടി പുതിയ മാറ്റങ്ങൾ പരിശോധിക്കുന്നു',
@@ -2750,7 +2751,7 @@ $1',
 'delete_and_move' => 'മായ്ക്കുകയും മാറ്റുകയും ചെയ്യുക',
 'delete_and_move_text' => '==താൾ മായ്ക്കേണ്ടിയിരിക്കുന്നു==
 
-താà´\99àµ\8dà´\95ൾ à´¸àµ\83à´·àµ\8dà´\9fà´¿à´\95àµ\8dà´\95ാൻ à´¶àµ\8dരമിà´\9aàµ\8dà´\9a "[[:$1]]" à´\8eà´¨àµ\8dà´¨ à´¤à´¾àµ¾ à´¨à´¿à´²à´µà´¿à´²àµ\81à´£àµ\8dà´\9fàµ\8d. à´\86 à´¤à´¾àµ¾ à´®à´¾à´¯àµ\8dà´\9aàµ\8dà´\9aàµ\8d à´ªàµ\81തിയ à´¤à´²à´\95àµ\8dà´\95àµ\86à´\9fàµ\8dà´\9fàµ\8d à´¨àµ½കേണ്ടതുണ്ടോ?',
+മാറàµ\8dറാനായി à´¨àµ½à´\95à´¿à´¯ "[[:$1]]" à´\8eà´¨àµ\8dà´¨ à´¤à´¾àµ¾ à´¨à´¿à´²à´µà´¿à´²àµ\81à´£àµ\8dà´\9fàµ\8d. à´\88 à´®à´¾à´±àµ\8dà´±à´\82 à´¨à´\9fà´¤àµ\8dà´¤àµ\81à´¨àµ\8dനതിനàµ\81à´µàµ\87à´£àµ\8dà´\9fà´¿ à´\86 à´¤à´¾àµ¾ à´®à´¾à´¯àµ\8dà´\95àµ\8dകേണ്ടതുണ്ടോ?',
 'delete_and_move_confirm' => 'ശരി, താൾ നീക്കം ചെയ്യുക',
 'delete_and_move_reason' => '"[[$1]]" എന്നതിൽ നിന്നും മാറ്റാനുള്ള സൗകര്യത്തിനായി മായ്ച്ചു',
 'selfmove' => 'പഴയ തലക്കെട്ടു തന്നെയാണ് മാറ്റാനായി നൽകിയിരിക്കുന്നത്; അതിനാൽ തലക്കെട്ടുമാറ്റം സാദ്ധ്യമല്ല.',
index 6c762c3..9035749 100644 (file)
@@ -859,6 +859,7 @@ Masukan log sekatan terakhir disediakan di bawah sebagai rujukan:',
 'note' => "'''Catatan:'''",
 'previewnote' => "'''Ingatlah bahawa ini hanya pralihat.'''
 Perubahan anda belum disimpan!",
+'continue-editing' => 'Teruskan menyunting',
 'previewconflict' => 'Paparan ini merupakan teks di bahagian atas dalam kotak sunting teks. Teks ini akan disimpan sekiranya anda memilih berbuat demikian.',
 'session_fail_preview' => "'''Kami tidak dapat memproses suntingan anda kerana kehilangan data sesi. Sila cuba lagi. Jika masalah ini berlanjutan, [[Special:UserLogout|log keluar]] dahulu, kemudian log masuk sekali lagi.'''",
 'session_fail_preview_html' => "'''Kami tidak dapat memproses suntingan anda kerana kehilangan data sesi.'''
index 62f921d..43de418 100644 (file)
@@ -1050,6 +1050,7 @@ Uw eigen .css- en .js-pagina's beginnen met een kleine letter, bijvoorbeeld {{ns
 'note' => "'''Opmerking:'''",
 'previewnote' => "'''Let op: dit is een controlepagina.'''
 Uw tekst is niet opgeslagen!",
+'continue-editing' => 'Doorgaan met bewerken',
 'previewconflict' => 'Deze voorvertoning geeft aan hoe de tekst in het bovenste veld eruit ziet als u deze opslaat.',
 'session_fail_preview' => "'''Uw bewerking is niet verwerkt, omdat de sessiegegevens verloren zijn gegaan.
 Probeer het opnieuw.
index faa9510..b5cf2ac 100644 (file)
@@ -3909,6 +3909,8 @@ Imagens serão apresentadas pelo browser na resolução máxima; ficheiros de ou
 'newuserlog-byemail' => 'palavra-chave enviada por correio-electrónico',
 
 # Feedback
+'feedback-bugornote' => 'Se está pronto para descrever um problema técnico em detalhe, por favor, [$1 denuncie um defeito].
+Caso contrário, pode facilmente usar o formulário abaixo. O seu comentário será adicionado à página "[$3 $2]", junto com o seu nome de utilizador e o navegador que está a usar.',
 'feedback-subject' => 'Assunto:',
 'feedback-message' => 'Mensagem:',
 'feedback-cancel' => 'Cancelar',
@@ -3917,9 +3919,10 @@ Imagens serão apresentadas pelo browser na resolução máxima; ficheiros de ou
 'feedback-error1' => 'Erro: O resultado da API não foi reconhecido',
 'feedback-error2' => 'Erro: A edição falhou',
 'feedback-error3' => 'Erro: A API não responde',
+'feedback-thanks' => 'Obrigado! O seu comentário foi adicionado à página "[ $2  $1 ]".',
 'feedback-close' => 'Feito',
 'feedback-bugcheck' => 'Perfeito! Verifique apenas que não é já um dos [$1 defeitos conhecidos].',
-'feedback-bugnew' => 'Eu verifiquei. Reportar um novo bug.',
+'feedback-bugnew' => 'Eu verifiquei. Denunciar um novo defeito.',
 
 # API errors
 'api-error-badaccess-groups' => 'Não tem permissão para enviar ficheiros para esta wiki.',
index e3a6b6f..7889fd0 100644 (file)
@@ -979,6 +979,7 @@ Paginile .css și .js specifice utilizatorilor au titluri care încep cu literă
 'note' => "'''Notă:'''",
 'previewnote' => "'''Țineți cont că aceasta este doar o previzualizare.'''
 Modificările dumneavoastră nu au fost încă salvate!",
+'continue-editing' => 'Continuare editare',
 'previewconflict' => 'Această pre-vizualizare reflectă textul din caseta de sus, respectiv felul în care va arăta articolul dacă alegeți să-l salvați acum.',
 'session_fail_preview' => "'''Ne pare rău! Nu am putut procesa modificarea dumneavoastră din cauza pierderii datelor sesiunii.
 Vă rugăm să încercați din nou.
index 6be77b9..fc2e86c 100644 (file)
@@ -600,8 +600,8 @@ $2',
 'nologin' => "איר האט נישט קיין קאנטע? '''$1'''.",
 'nologinlink' => 'באשאפֿט א קאנטע',
 'createaccount' => 'באשאפֿט א נייע קאנטע',
-'gotaccount' => "האסט שוין א קאנטע? '''$1'''.",
-'gotaccountlink' => 'אריינלאגירן',
+'gotaccount' => "האסטו שוין א קאנטע? '''$1'''.",
+'gotaccountlink' => 'אַרײַנלאגירן',
 'userlogin-resetlink' => 'פארגעסן אײַערע אַרײַנלאָגירן פרטים?',
 'createaccountmail' => 'דורך ע-פאסט',
 'createaccountreason' => 'אורזאַך:',
@@ -3472,4 +3472,14 @@ $5
 'api-error-uploaddisabled' => 'ארויפֿלאָדן איז אומאַקטיווירט אויף דער וויקי',
 'api-error-verification-error' => 'די טעקע איז מעגלעך פֿארדארבן, אדער האט א פֿאַלשע ענדונג.',
 
+# Durations
+'duration-seconds' => '$1 {{PLURAL:$1|סעקונדע|סעקונדעס}}',
+'duration-minutes' => '$1 {{PLURAL:$1|מינוט|מינוט}}',
+'duration-hours' => "$1 {{PLURAL:$1|שעה|שעה'ן}}",
+'duration-days' => '$1 {{PLURAL:$1|טאג|טעג}}',
+'duration-weeks' => '$1 {{PLURAL:$1|וואך|וואכן}}',
+'duration-years' => '$1 {{PLURAL:$1|יאר|יאר}}',
+'duration-decades' => '$1 {{PLURAL:$1|צענדליקער|צענדליקערס}}',
+'duration-centuries' => '$1 {{PLURAL:$1|יארהונדערט|יארהונדערטער}}',
+
 );
index 7abbc90..a7c7ec4 100644 (file)
@@ -201,7 +201,7 @@ class RefreshLinks extends Maintenance {
         * @param $id int The page_id
         */
        public static function fixLinksFromArticle( $id ) {
-               global $wgParser;
+               global $wgParser, $wgContLang;
 
                $title = Title::newFromID( $id );
                $dbw = wfGetDB( DB_MASTER );
@@ -219,7 +219,7 @@ class RefreshLinks extends Maintenance {
 
                $dbw->begin( __METHOD__ );
 
-               $options = new ParserOptions;
+               $options = ParserOptions::newFromUserAndLang( new User, $wgContLang );
                $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
                $update = new LinksUpdate( $title, $parserOutput, false );
                $update->doUpdate();
index 148b08b..eb281f8 100644 (file)
@@ -1292,6 +1292,7 @@ var mw = ( function ( $, undefined ) {
                                 */
                                state: function ( module, state ) {
                                        var m;
+
                                        if ( typeof module === 'object' ) {
                                                for ( m in module ) {
                                                        mw.loader.state( m, module[m] );
@@ -1301,7 +1302,14 @@ var mw = ( function ( $, undefined ) {
                                        if ( registry[module] === undefined ) {
                                                mw.loader.register( module );
                                        }
-                                       registry[module].state = state;
+                                       if ( state === 'ready' && registry[module].state !== state) {
+                                               // Make sure pending modules depending on this one get executed if their
+                                               // dependencies are now fulfilled!
+                                               registry[module].state = state;
+                                               handlePending( module );
+                                       } else {
+                                               registry[module].state = state;
+                                       }
                                },
                
                                /**
index 2e95f55..612c368 100644 (file)
@@ -1307,6 +1307,26 @@ class FileBackendTest extends MediaWikiTestCase {
 
                $this->assertEquals( $expected, $list, "Correct file listing ($backendName), second iteration." );
 
+               // Expected listing (top files only)
+               $expected = array(
+                       "test1.txt",
+                       "test2.txt",
+                       "test3.txt",
+                       "test4.txt",
+                       "test5.txt"
+               );
+               sort( $expected );
+
+               // Actual listing (top files only)
+               $list = array();
+               $iter = $this->backend->getTopFileList( array( 'dir' => "$base/unittest-cont1/subdir2/subdir" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top file listing ($backendName)." );
+
                foreach ( $files as $file ) { // clean up
                        $this->backend->doOperation( array( 'op' => 'delete', 'src' => $file ) );
                }
@@ -1315,6 +1335,182 @@ class FileBackendTest extends MediaWikiTestCase {
                foreach ( $iter as $iter ) {} // no errors
        }
 
+       public function testGetDirectoryList() {
+               $this->backend = $this->singleBackend;
+               $this->tearDownFiles();
+               $this->doTestGetDirectoryList();
+               $this->tearDownFiles();
+
+               $this->backend = $this->multiBackend;
+               $this->tearDownFiles();
+               $this->doTestGetDirectoryList();
+               $this->tearDownFiles();
+       }
+
+       private function doTestGetDirectoryList() {
+               $backendName = $this->backendClass();
+
+               $base = $this->baseStorePath();
+               $files = array(
+                       "$base/unittest-cont1/test1.txt",
+                       "$base/unittest-cont1/test2.txt",
+                       "$base/unittest-cont1/test3.txt",
+                       "$base/unittest-cont1/subdir1/test1.txt",
+                       "$base/unittest-cont1/subdir1/test2.txt",
+                       "$base/unittest-cont1/subdir2/test3.txt",
+                       "$base/unittest-cont1/subdir2/test4.txt",
+                       "$base/unittest-cont1/subdir2/subdir/test1.txt",
+                       "$base/unittest-cont1/subdir3/subdir/test2.txt",
+                       "$base/unittest-cont1/subdir4/subdir/test3.txt",
+                       "$base/unittest-cont1/subdir4/subdir/test4.txt",
+                       "$base/unittest-cont1/subdir4/subdir/test5.txt",
+                       "$base/unittest-cont1/subdir4/subdir/sub/test0.txt",
+                       "$base/unittest-cont1/subdir4/subdir/sub/120-px-file.txt",
+               );
+
+               // Add the files
+               $ops = array();
+               foreach ( $files as $file ) {
+                       $this->prepare( array( 'dir' => dirname( $file ) ) );
+                       $ops[] = array( 'op' => 'create', 'content' => 'xxy', 'dst' => $file );
+               }
+               $status = $this->backend->doOperations( $ops );
+               $this->assertEquals( array(), $status->errors,
+                       "Creation of files succeeded ($backendName)." );
+               $this->assertEquals( true, $status->isOK(),
+                       "Creation of files succeeded with OK status ($backendName)." );
+
+               // Expected listing
+               $expected = array(
+                       "subdir1",
+                       "subdir2",
+                       "subdir3",
+                       "subdir4",
+               );
+               sort( $expected );
+
+               $this->assertEquals( true,
+                       $this->backend->directoryExists( array( 'dir' => "$base/unittest-cont1/subdir1" ) ),
+                       "Directory exists in ($backendName)." );
+               $this->assertEquals( true,
+                       $this->backend->directoryExists( array( 'dir' => "$base/unittest-cont1/subdir2/subdir" ) ),
+                       "Directory exists in ($backendName)." );
+               $this->assertEquals( false,
+                       $this->backend->directoryExists( array( 'dir' => "$base/unittest-cont1/subdir2/test1.txt" ) ),
+                       "Directory does not exists in ($backendName)." );
+
+               // Actual listing (no trailing slash)
+               $list = array();
+               $iter = $this->backend->getTopDirectoryList( array( 'dir' => "$base/unittest-cont1" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName)." );
+
+               // Actual listing (with trailing slash)
+               $list = array();
+               $iter = $this->backend->getTopDirectoryList( array( 'dir' => "$base/unittest-cont1/" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName)." );
+
+               // Expected listing
+               $expected = array(
+                       "subdir",
+               );
+               sort( $expected );
+
+               // Actual listing (no trailing slash)
+               $list = array();
+               $iter = $this->backend->getTopDirectoryList( array( 'dir' => "$base/unittest-cont1/subdir2" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName)." );
+
+               // Actual listing (with trailing slash)
+               $list = array();
+               $iter = $this->backend->getTopDirectoryList( array( 'dir' => "$base/unittest-cont1/subdir2/" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName)." );
+
+               // Actual listing (using iterator second time)
+               $list = array();
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName), second iteration." );
+
+               // Expected listing (recursive)
+               $expected = array(
+                       "subdir1",
+                       "subdir2",
+                       "subdir3",
+                       "subdir4",
+                       "subdir2/subdir",
+                       "subdir3/subdir",
+                       "subdir4/subdir",
+                       "subdir4/subdir/sub",
+               );
+               sort( $expected );
+
+               // Actual listing (recursive)
+               $list = array();
+               $iter = $this->backend->getDirectoryList( array( 'dir' => "$base/unittest-cont1/" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct dir listing ($backendName)." );
+
+               // Expected listing (recursive)
+               $expected = array(
+                       "subdir",
+                       "subdir/sub",
+               );
+               sort( $expected );
+
+               // Actual listing (recursive)
+               $list = array();
+               $iter = $this->backend->getDirectoryList( array( 'dir' => "$base/unittest-cont1/subdir4" ) );
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct dir listing ($backendName)." );
+
+               // Actual listing (recursive, second time)
+               $list = array();
+               foreach ( $iter as $file ) {
+                       $list[] = $file;
+               }
+               sort( $list );
+
+               $this->assertEquals( $expected, $list, "Correct dir listing ($backendName)." );
+
+               foreach ( $files as $file ) { // clean up
+                       $this->backend->doOperation( array( 'op' => 'delete', 'src' => $file ) );
+               }
+
+               $iter = $this->backend->getDirectoryList( array( 'dir' => "$base/unittest-cont1/not/exists" ) );
+               foreach ( $iter as $iter ) {} // no errors
+       }
+
        // test helper wrapper for backend prepare() function
        private function prepare( array $params ) {
                $this->dirsToPrune[] = $params['dir'];