User Tools

Site Tools


tools:db:new-importer
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Last revision
tools:db:new-importer [2019/01/12 17:53] – external edit 127.0.0.1
Line 1: Line 1:
 +====== Experimental importer for 0.804+ (Vivace+1) ======
 +
 +===== Usage =====
 +  - Login as usual through the web interface
 +  - Upload the code as 'import.php' in your FP web root (usually ''flatpress/'')
 +  - Browse to http://yoursite.com/flatpress/import.php
 +  - Wait for the page to finish loading.
 +
 +Your index should now have been rebuilt.
 +
 +**remove the file ''import.php'' when done!** 
 +
 +
 +<code php><?php
 + require('defaults.php');
 + require(INCLUDES_DIR.'includes.php');
 +
 + system_init();
 + header('Content-Type: text/plain');
 +
 + if (!user_loggedin()) exit('You must login.');
 +
 +
 + class s_entry_crawler extends fs_filelister {
 +
 + var $_directory = CONTENT_DIR;
 +
 + function __construct() {
 + $this->index =& entry_init();
 + parent::__construct();
 + }
 +
 + function _checkFile($directory, $file) {
 + $f = "$directory/$file";
 + if ( is_dir($f) && ctype_digit($file)) {
 + return 1;
 + }
 +
 + if (fnmatch('entry*'.EXT, $file)) {
 + $id=basename($file,EXT);
 + $arr=entry_parse($id, true);
 +
 + echo "[POST] $id => {$arr['SUBJECT']}\n";
 + $this->index->add($id, $arr);
 +
 + return 0;
 + }
 + }
 +
 + }
 +
 +
 + echo "FlatPress importing utility .804+\n";
 + echo "=================================\n\n";
 +
 + echo "This may take some time, please wait...\n\n";
 +
 + new s_entry_crawler;
 +
 +</code>
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki