Avoid deprecated LinkCache::singleton()
[lhc/web/wiklou.git] / includes / OutputPage.php
index c51f6f8..1dd6a41 100644 (file)
@@ -1368,7 +1368,8 @@ class OutputPage extends ContextSource {
                );
 
                # Add the results to the link cache
-               $lb->addResultToCache( LinkCache::singleton(), $res );
+               $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+               $lb->addResultToCache( $linkCache, $res );
 
                return $res;
        }
@@ -2645,13 +2646,13 @@ class OutputPage extends ContextSource {
 
                        foreach ( $errors as $error ) {
                                $text .= '<li>';
-                               $text .= call_user_func_array( [ $this, 'msg' ], $error )->plain();
+                               $text .= $this->msg( ...$error )->plain();
                                $text .= "</li>\n";
                        }
                        $text .= '</ul>';
                } else {
                        $text .= "<div class=\"permissions-errors\">\n" .
-                                       call_user_func_array( [ $this, 'msg' ], reset( $errors ) )->plain() .
+                                       $this->msg( ...reset( $errors ) )->plain() .
                                        "\n</div>";
                }
 
@@ -4018,8 +4019,8 @@ class OutputPage extends ContextSource {
                }
                if ( $this->CSPNonce === null ) {
                        // XXX It might be expensive to generate randomness
-                       // on every request, on windows.
-                       $rand = MWCryptRand::generate( 15 );
+                       // on every request, on Windows.
+                       $rand = random_bytes( 15 );
                        $this->CSPNonce = base64_encode( $rand );
                }
                return $this->CSPNonce;