mediawikiの更新手順
バージョンが上がって「設定」が古くなったので書き直しました。作業順序は以下の通り。
- /var/www/html/”mediwaiki導入フォルダ”/LocalSettings.phpのバックアップ
- /var/www/html/”mediawiki導入フォルダ”/images, HTMLetsフォルダ以外を削除
- 新バージョンのmediwaikiを”mediawiki導入フォルダへコピー”
- 追加導入しているextensionsをコピー
- LocalSettings.phpを戻す(chown -Rで”導入フォルダ”の所有者をwww-dataとする)
- /var/www/html/”mediawiki導入フォルダ”/php maintenance/update.php –quick実行
- 各種動作確認を行う
追加extensionsの処置のうち「Elastica」から対処します。
In the downloaded files, open a command line and change to the subdirectory of the "Elastica" extension Run composer install --no-dev
DynamicPageList修正。399行目付近を以下のように修正する。
if ( $this->mIncMaxLen > 0 && ( strlen( $text ) > $this->mIncMaxLen ) ) { $textx = DPLInclude::limitTranscludedText($text, $this->mIncMaxLen,""); $posx = mb_strrpos($textx, "[["); $posy = mb_strrpos($textx, "]]"); if ($posx) { if ($posx > $posy) { $chgpos = mb_strpos($text, "]]", $posx); $this->mIncMaxLen = $chgpos * 2 + 2; } } $text = DPLInclude::limitTranscludedText( $text, $this->mIncMaxLen, ' [[' . $title . '|...more]]' ); }
もう一箇所、DynamicPageListInclude.phpの323行目を以下のように修正する。
// $cut = substr( $text, 0, $n0 + 1 ); $cut = mb_strimwidth( $text, 0, $n0 + 1 );
次に広告の調整をする。189行目付近の修正を行う。
<?php $this->renderPortals( $this->data['sidebar'] ); ?> <div style="padding-top:20px;text-align:center;"><span style="font-size:12px;color:#a6a6a6">スポンサーリンク</span> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- ad-auto --> <div> <ins class="adsbygoogle" style="display:inline-block;width:120px;hight:600px" data-ad-client="ca-pub-9709904800907040" data-ad-slot="4216768533" data-ad-format="auto"></ins> </div></div> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
上記コードの直後を以下のように修正する。
<?php Hooks::run( 'VectorBeforeFooter' ); ?> <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>> <div style="float:right;text-align:center;"><span style="font-size:12px;color:#a6a6a6">スポンサーリンク</span> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- ad-468x60 --> <div> <ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px" data-ad-client="ca-pub-9709904800907040" data-ad-slot="9973341612"></ins> </div></div> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
mediwaikiアイコンが狙ったところに表示されなかったので、以下の修正を加える。「footer-icons」の前に「clear:both」を追加。その下の「footer-」をli要素からul要素へ変更する。
<?php $footericons = $this->getFooterIcons( 'icononly' ); if ( count( $footericons ) > 0 ) { ?> <div style="clear:both"> <ul id="footer-icons" class="noprint"> <?php foreach ( $footericons as $blockName => $footerIcons ) { ?> <ul id="footer-<?php echo htmlspecialchars( $blockName ); ?>ico"> <?php foreach ( $footerIcons as $icon ) { echo $this->getSkin()->makeFooterIcon( $icon ); } ?> </ul>
フォントとフォントサイズは好みの問題もあるが、sans系を明朝体で表示すると「チープ」な安っぽいサイトに見えるので、全て「Arial」へ変更する。全くの個人の好みw
@html-font-size: 100%; // Page content // FIXME: Use global variable since Echo and CentralNotice use this variable @content-border-color: #a7d7f9; // FIXME: Find an open font that works with this stack and is readable by Windows users @content-font-family: Arial; @content-font-color: #222; @content-font-size: 0.875em; @content-line-height: 1.6; @content-padding: 1em; @content-heading-font-size: 1.8em; @content-heading-font-family: Arial; @content-heading-font-family-generic: Arial; @body-background-color: #fff; @heading-line-height: 1.3;
環境によっては左サイドバーの幅が足りないので、85行目を以下のように修正する。
/* Panel */ div#mw-panel { font-size: @menu-main-font-size; position: absolute; top: 160px; padding-top: 1em; width: 11em; --> 10emから増やす left: 0;
問い合わせ先を表示する。418行目付近を以下のように修正する。「contact」を追加。
$tpl->set( 'copyrightico', $this->getCopyrightIcon() ); $tpl->set( 'poweredbyico', $this->getPoweredBy() ); $tpl->set( 'disclaimer', $this->disclaimerLink() ); $tpl->set( 'privacy', $this->privacyLink() ); $tpl->set( 'about', $this->aboutLink() ); $tpl->set( 'contact', '<a href=mailto:webmaster@setakinoko.es>お 問い合わせ</a>' ); $tpl->set( 'footerlinks', [ 'info' => [ 'lastmod', 'numberofwatchingusers', 'credits', 'copyright', ], 'places' => [ 'privacy', 'about', 'disclaimer', 'contact',
広告のモバイル対応は「この記事」を参考にする。ここではログイン時に表示されるユーザー名を消去する設定。
public function getPageClasses( $title ) { $className = parent::getPageClasses( $title ); $className .= ' ' . ( $this->getSkinOption( self::OPTIONS_MOBILE_BETA ) ? 'beta' : 'stable' ); if ( $title->isMainPage() ) { $className .= ' page-Main_Page '; } if ( $this->isAuthenticatedUser() ) { // $className .= ' is-authenticated'; } return $className; }