Jump to content

Topic on Manual talk:Sqlite.php

How do I restore from a backup?

2
Shouya0 (talkcontribs)

I want to restore my wiki from an older backup. What I did is to deleted the queue and l10n_cache database files and replaced <my_wiki>.sqlite with the backup. However, after I did these and trying to visit the wiki, those two database files I deleted wasn't recreated as I expected and the wiki page prompts something like this:

#0 /var/www/html/includes/libs/rdbms/database/DatabaseSqlite.php(142): Wikimedia\Rdbms\DatabaseSqlite->open(false, false, false, 'my_wiki_l10n_ca...', NULL, '')
#1 /var/www/html/includes/libs/rdbms/database/Database.php(350): Wikimedia\Rdbms\DatabaseSqlite->doInitConnection()
#2 /var/www/html/includes/libs/rdbms/database/Database.php(473): Wikimedia\Rdbms\Database->initConnection()
#3 /var/www/html/includes/cache/localisation/LCStoreDB.php(137): Wikimedia\Rdbms\Database::factory('sqlite', Array)
#4 /var/www/html/includes/cache/localisation/LCStoreDB.php(52): LCStoreDB->getWriteConnection()
#5 /var/www/html/includes/cache/localisation/LocalisationCache.php(410): LCStoreDB->get('en', 'deps')
#6 /var/www/html/includes/cache/localisation/LocalisationCache.php(456): LocalisationCache->isExpired('en')
#7 /var/www/html/includes/cache/localisation/LocalisationCache.php(375): LocalisationCache->initLanguage('en')
#8 /var/www/html/includes/cache/localisation/LocalisationCache.php(294): LocalisationCache->loadSubitem('en', 'messages', 'title-invalid-e...')
#9 /var/www/html/languages/Language.php(2645): LocalisationCache->getSubitem('en', 'messages', 'title-invalid-e...')
#10 /var/www/html/includes/cache/MessageCache.php(989): Language->getMessage('title-invalid-e...')
#11 /var/www/html/includes/cache/MessageCache.php(947): MessageCache->getMessageForLang(Object(LanguageEn), 'title-invalid-e...', false, Array)
#12 /var/www/html/includes/cache/MessageCache.php(889): MessageCache->getMessageFromFallbackChain(Object(LanguageEn), 'title-invalid-e...', false)
#13 /var/www/html/includes/Message.php(1308): MessageCache->get('title-invalid-e...', false, Object(LanguageEn))
#14 /var/www/html/includes/Message.php(863): Message->fetchMessage()
#15 /var/www/html/includes/Message.php(955): Message->toString('text')
#16 /var/www/html/includes/title/MalformedTitleException.php(49): Message->text()
#17 /var/www/html/includes/title/MediaWikiTitleCodec.php(297): MalformedTitleException->__construct('title-invalid-e...', '')
#18 /var/www/html/includes/Title.php(3139): MediaWikiTitleCodec->splitTitleString('', 0)
#19 /var/www/html/includes/Title.php(407): Title->secureAndSplit()
#20 /var/www/html/includes/MediaWiki.php(83): Title::newFromURL(NULL)
#21 /var/www/html/includes/MediaWiki.php(140): MediaWiki->parseTitle()
#22 /var/www/html/includes/MediaWiki.php(781): MediaWiki->getTitle()
#23 /var/www/html/includes/MediaWiki.php(515): MediaWiki->main()
#24 /var/www/html/index.php(42): MediaWiki->run()
#25 {main}


It looks like the error is about missing database/table. How can I resolve it? BTW here's my database related config in LocalSettings.php:


# SQLite-specific settings
$wgSQLiteDataDir = "/var/www/data";
$wgObjectCaches[CACHE_DB] = [
  'class' => SqlBagOStuff::class,
  'loggroup' => 'SQLBagOStuff',
  'server' => [
    'type' => 'sqlite',
    'dbname' => 'wikicache',
    'tablePrefix' => '',
    'variables' => [ 'synchronous' => 'NORMAL' ],
    'dbDirectory' => $wgSQLiteDataDir,
    'trxMode' => 'IMMEDIATE',
    'flags' => 0
  ]
];
$wgLocalisationCacheConf['storeServer'] = [
  'type' => 'sqlite',
  'dbname' => "{$wgDBname}_l10n_cache",
  'tablePrefix' => '',
  'variables' => [ 'synchronous' => 'NORMAL' ],
  'dbDirectory' => $wgSQLiteDataDir,
  'trxMode' => 'IMMEDIATE',
  'flags' => 0
];
$wgJobTypeConf['default'] = [
  'class' => 'JobQueueDB',
  'claimTTL' => 3600,
  'server' => [
    'type' => 'sqlite',
    'dbname' => "{$wgDBname}_jobqueue",
    'tablePrefix' => '',
    'dbDirectory' => $wgSQLiteDataDir,
    'trxMode' => 'IMMEDIATE',
    'flags' => 0
  ]
];


MaxSem (talkcontribs)

Reinstall MediaWiki, then replace the files you have a backup for. You can reinstall by moving LocalSettings.php away and later putting it back.

Reply to "How do I restore from a backup?"