Follow-up to r58633 and r58628 (lqt): Rename Title::getProtectionTypes to Title:...
[lhc/web/wiklou.git] / includes / Article.php
index 42625e3..3e34405 100644 (file)
@@ -60,7 +60,9 @@ class Article {
         */
        public static function newFromID( $id ) {
                $t = Title::newFromID( $id );
-               return $t == null ? null : new Article( $t );
+               # FIXME: doesn't inherit right
+               return $t == null ? null : new self( $t );
+               #return $t == null ? null : new static( $t ); // PHP 5.3
        }
 
        /**
@@ -2254,7 +2256,9 @@ class Article {
         * @return bool true on success
         */
        public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
-               global $wgUser, $wgRestrictionTypes, $wgContLang;
+               global $wgUser, $wgContLang;
+               
+               $restrictionTypes = $this->mTitle->getRestrictionTypes();
 
                $id = $this->mTitle->getArticleID();
                if ( $id <= 0 ) {
@@ -2284,7 +2288,7 @@ class Article {
                $current = array();
                $updated = Article::flattenRestrictions( $limit );
                $changed = false;
-               foreach( $wgRestrictionTypes as $action ) {
+               foreach( $restrictionTypes as $action ) {
                        if( isset( $expiry[$action] ) ) {
                                # Get current restrictions on $action
                                $aLimits = $this->mTitle->getRestrictions( $action );
@@ -3456,16 +3460,15 @@ class Article {
 
                $cdel = '';
                // User can delete revisions or view deleted revisions...
-               $canHide = $wgUser->isAllowed('deleterevision');
+               $canHide = $wgUser->isAllowed( 'deleterevision' );
                if( $canHide || ($revision->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
-                       // Is this hidden from Sysops?
                        if( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) {
-                               $cdel = $sk->revDeleteLinkDisabled( $canHide );
+                               $cdel = $sk->revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops
                        } else {
                                $query = array(
                                        'type'   => 'revision',
-                                       'target' => urlencode( $this->mTitle->getPrefixedDbkey() ),
-                                       'ids'    => urlencode( $oldid )
+                                       'target' => $this->mTitle->getPrefixedDbkey(),
+                                       'ids'    => $oldid
                                );
                                $cdel = $sk->revDeleteLink( $query, $revision->isDeleted(File::DELETED_RESTRICTED), $canHide );
                        }