3 This replaces Admin/PrepareAutolinking and enables itself if you
4 have the "plugins/linking/autolinking.php" enabled.
6 -> creates a cache entry for pages with single-word and non-wiki names
9 #-- cfg (already in the according plugin)
10 // define("EWIKI_AUTOLINKING_CACHE", "system/tmp/autolinking");
13 #-- start if plugin loaded / constant defined
14 if (defined("EWIKI_AUTOLINKING_CACHE")) {
20 $result = ewiki_db::GETALL(array("id", "flags"));
21 while ($row = $result->get()) {
23 if (EWIKI_DB_F_TEXT != ($row["flags"] & EWIKI_DB_F_TYPE)) {
28 #-- only care about pagenames, which are words but no WikiWords
29 if (!strpos($id, " ") && preg_match('/^\w+$/', $id)
30 && !preg_match('/^(['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+){2,}[\w\d]*$/', $id))
37 #-- save found pages in cache entry
38 $DEST = EWIKI_AUTOLINKING_CACHE;
42 "flags" => EWIKI_DB_F_SYSTEM,
44 "lastmodified" => time(),
45 "author" => ewiki_author("PrepareAutolinking"),
48 "refs" => "\n\n" . implode("\n", $pages) . "\n\n",
50 $ok = ewiki_db::WRITE($save, true);
54 echo "[$cron]: Written informations about ".count($pages)." pages into the database cache entry '$DEST'"
55 . "\n These pages will then get autolinked by the according plugin.\n";
58 echo "[$cron]: Error writing the database cache entry '$DEST'. Autolinking pages won't work now.\n";