Skip to content

Instantly share code, notes, and snippets.

@shtrom
Created November 27, 2016 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shtrom/658b50af2529f44b26c8736b4261111d to your computer and use it in GitHub Desktop.
Save shtrom/658b50af2529f44b26c8736b4261111d to your computer and use it in GitHub Desktop.
Export Wallabag 1.9 (and maybe other 1.x) library.
<?php
/* Export Wallabag 1.9 (and maybe other 1.x) library.
*
* Olivier Mehani <shtrom+wallabag@ssji.net>, 2016
* MIT license (same as Wallabag itself)
*
* Particularly useful in * case the normal export process dies with a message
* such as
*
* PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 74558957 bytes) in /srv/www/wallabag/inc/poche/Tools.class.php on line 231
*
* Usage: place script in the root directory of your Wallabag installation, then run
*
* php -d memory_limit=256M wallabag19-export.php USERID
*
* Increase the memory limit if you still get fatal errors.
*/
require_once 'inc/poche/global.inc.php';
$p = new Poche();
if (count($argv) < 2) {
error_log("usage: php -d memory_limit=xxxM {$argv[0]} USERID", 0);
die(1);
} else {
$userid = $argv[1];
$entries = $p->store->retrieveAllWithTags($userid);
echo $p->tpl->render('export.twig', array(
'export' => Tools::renderJson($entries),
));
}
@shtrom
Copy link
Author

shtrom commented Nov 27, 2016

@wallabag: FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment