Extension:GlobalUsage

From Biowikifarm Metawiki
Jump to: navigation, search

Configuration briefly:

  • set up $wgConf something like that, needs maybe some improvements. TODO suffixes
  # needed at least for openMedia to display global usage
  $wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
  $wgConf->settings = array(
      'wgSitename' => array(
          'ispiwiki' => 'Pestinfo-Wiki',
          'onwiki' => 'Offene Naturführer',
          'openmedia' => 'OpenMedia',
      ),
      'wgLanguageCode' => array(
          'default' => 'en',
          'onwiki' => 'de-formal',
      ),
      'wgServer' => array(
          'ispiwiki' => $wgProto.'://wiki.pestinfo.org',
          'onwiki' => $wgProto.'://offene-naturfuehrer.de',
          'openmedia' => $wgProto.'://species-id.net',
      ),
      'wgCanonicalServer' => array(
          'ispiwiki' => $wgProto.'://wiki.pestinfo.org',
          'onwiki' => $wgProto.'://offene-naturfuehrer.de',
          'openmedia' => $wgProto.'://species-id.net',
      ),
      'wgScriptPath' => array(
          'ispiwiki' => '/w',
          'onwiki' => '/w',
          'openmedia' => '/o',
      ),
      'wgArticlePath' => array(
          'ispiwiki' => '/wiki/$1',
          'onwiki' => '/web/$1',
          'openmedia' => '/openmedia/$1',
      )
  );
  $wgLocalDatabases = array(
      'ispiwiki',
      'onwiki',
      'openmedia',
  );
  $wgConf->wikis = $wgLocalDatabases;
  /**
    * $wgConf->suffixes
    * AP 2016-08-23: not clear to me how suffixes need to be set and what's the relation to the 
    * configuration setup. They are relevant in SiteConfiguration::siteFromDB() to get global usage display or format external links
    * in a global setup
    * TODO openmedia does not properly show up, e.g. http://species-id.net/openmedia/File:Crystal_Clear_action_find.png
    */
  $wgConf->suffixes = array('wiki');
  $wgConf->extractAllGlobals( $wgDBname );
  • set up require_once('…') extension in shared repo wiki as well as on child wiki:
require_once "$IP/extensions/GlobalUsage/GlobalUsage.php";
  $wgGlobalUsageDatabase = 'openmedia';
  $wgGlobalUsageSharedRepoWiki = 'openmedia'; // undocumented. needed?
  /* add or delete links to the parent wiki when a file in a child wiki was inserted or removed */
  $wgGlobalUsagePurgeBacklinks = true;

in child Wiki

  • sudo -u www-data php ./maintenance/update.php --dbuser wikiadmin --quick --conf ./LocalSettings.php
  • sudo -u www-data php ./extensions/GlobalUsage/refreshGlobalimagelinks.php --dbuser wikiadmin --pages existing --conf ./LocalSettings.php
  • sudo -u www-data php ./extensions/GlobalUsage/refreshGlobalimagelinks.php --dbuser wikiadmin --pages nonexisting --conf ./LocalSettings.php