Merge "Removed old HTMLCacheUpdateJob b/c code"
[lhc/web/wiklou.git] / includes / api / ApiQueryTokens.php
index 279e8e3..f8eee8d 100644 (file)
@@ -37,8 +37,8 @@ class ApiQueryTokens extends ApiQueryBase {
                $params = $this->extractRequestParams();
                $res = array();
 
-               if ( $this->getMain()->getRequest()->getVal( 'callback' ) !== null ) {
-                       $this->setWarning( 'Tokens may not be obtained when using a callback' );
+               if ( $this->lacksSameOriginSecurity() ) {
+                       $this->setWarning( 'Tokens may not be obtained when the same-origin policy is not applied' );
                        return;
                }
 
@@ -55,7 +55,6 @@ class ApiQueryTokens extends ApiQueryBase {
        public static function getTokenTypeSalts() {
                static $salts = null;
                if ( !$salts ) {
-                       wfProfileIn( __METHOD__ );
                        $salts = array(
                                'csrf' => '',
                                'watch' => 'watch',
@@ -63,9 +62,8 @@ class ApiQueryTokens extends ApiQueryBase {
                                'rollback' => 'rollback',
                                'userrights' => 'userrights',
                        );
-                       wfRunHooks( 'ApiQueryTokensRegisterTypes', array( &$salts ) );
+                       Hooks::run( 'ApiQueryTokensRegisterTypes', array( &$salts ) );
                        ksort( $salts );
-                       wfProfileOut( __METHOD__ );
                }
 
                return $salts;