Remove mediawiki.special.javaScriptTest module
[lhc/web/wiklou.git] / includes / specials / SpecialUndelete.php
index 664205a..aada064 100644 (file)
@@ -625,11 +625,14 @@ class PageArchive {
                $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
                if ( $created || $wasnew ) {
                        // Update site stats, link tables, etc
-                       $user = User::newFromName( $revision->getUserText( Revision::RAW ), false );
                        $article->doEditUpdates(
                                $revision,
-                               $user,
-                               array( 'created' => $created, 'oldcountable' => $oldcountable )
+                               User::newFromName( $revision->getUserText( Revision::RAW ), false ),
+                               array(
+                                       'created' => $created,
+                                       'oldcountable' => $oldcountable,
+                                       'restored' => true
+                               )
                        );
                }
 
@@ -697,7 +700,7 @@ class SpecialUndelete extends SpecialPage {
                $this->mTargetObj = null;
 
                if ( $this->mTarget !== null && $this->mTarget !== '' ) {
-                       $this->mTargetObj = Title::newFromURL( $this->mTarget );
+                       $this->mTargetObj = Title::newFromText( $this->mTarget );
                }
 
                $this->mSearchPrefix = $request->getText( 'prefix' );
@@ -1194,10 +1197,10 @@ class SpecialUndelete extends SpecialPage {
        private function showFile( $key ) {
                $this->getOutput()->disable();
 
-               # We mustn't allow the output to be Squid cached, otherwise
+               # We mustn't allow the output to be CDN cached, otherwise
                # if an admin previews a deleted image, and it's cached, then
                # a user without appropriate permissions can toddle off and
-               # nab the image, and Squid will serve it
+               # nab the image, and CDN will serve it
                $response = $this->getRequest()->response();
                $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
                $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
@@ -1689,6 +1692,26 @@ class SpecialUndelete extends SpecialPage {
                }
        }
 
+       /**
+        * Return an array of subpages beginning with $search that this special page will accept.
+        *
+        * @param string $search Prefix to search for
+        * @param int $limit Maximum number of results to return (usually 10)
+        * @param int $offset Number of results to skip (usually 0)
+        * @return string[] Matching subpages
+        */
+       public function prefixSearchSubpages( $search, $limit, $offset ) {
+               $title = Title::newFromText( $search );
+               if ( !$title || !$title->canExist() ) {
+                       // No prefix suggestion in special and media namespace
+                       return array();
+               }
+               // Autocomplete subpage the same as a normal search
+               $prefixSearcher = new StringPrefixSearch;
+               $result = $prefixSearcher->search( $search, $limit, array(), $offset );
+               return $result;
+       }
+
        protected function getGroupName() {
                return 'pagetools';
        }