Hi,
i have a [template] in many pages and want do delete this [template] in all pages. Is this possible?
Hi,
i have a [template] in many pages and want do delete this [template] in all pages. Is this possible?
Since templates are adding in many pages as text, the only safe way to remove them is to edit that text.
- lead developer for VaultWiki
Is it possible to use a script or "addon" for vaultwiki ?
Yes, you can certainly write a script that:
1. Cycles through every page, one at a time.
2. For each page, run a preg_replace for the pagetext field.
3. Use the Page DM to apply the pagetext change.
4. Move on to the next page.
Code:// this code only runs batches of 500 pages, starting at $startat $pages = vw_DB::get()->query()->select(array( 'fields' => array('pageid'), 'table' => 'vw_page', 'order' => array('pageid' => 'ASC'), 'limit' => array($startat, 500) )); $pageids = array(); while ($page = vw_DB::get()->func()->fetch_array($pages)) { $pageids[$page['pageid']] = $page['pageid']; } vw_DB::get()->func()->free_result($pages); vw_Hard_Core::controller('Fetch')->get('Page', $pageids); foreach ($pageids AS $pageid) { $page = vw_Hard_Core::controller('Fetch')->get('Page', $pageid); if (empty($page['pagetext'])) // or pagetext does not contain search string { continue; } $dm = vw_Hard_Core::controller('DM')->create('Page', 'SILENT'); $dm->set_info('is_automated', 1); $dm->set_existing($page); // run your replacement code against $page['pagetext'] $dm->set('pagetext', $new_pagetext); $dm->save(); unset($dm); }
- lead developer for VaultWiki
Oh cool,
my problem: how can i use this script (where to save, where to start,etc.)
i'm not a pro in these things... :-(
Probably the easiest thing is to create an entry in the vault/core/controller/cp/counter folder. Look at the contents of the /url sub-folder for an idea how to implement it.
Then you would run it by finding it in the Wiki Admin Panel > Integrity > Rebuild Counters / Caches.
- lead developer for VaultWiki
Hi, there is only a index.html and one vw.php file - no other content for ideas :-(
Could you help me please ?
Use the content of the vw.php file as a template and create your own controller (named vw.php) in a new directory. The /url/vw.php file is a good example because it already modifies a bunch of pages (but also non-articles, like special pages and synonyms).
You really just need to modify a cloned version of this file so it performs the replacement you want against the pagetext field. If the pagetext field does not exist, then skip the entry.
You also want to remove the info lines that say to skip revisions or I think nothing will happen when you change the pagetext.
- lead developer for VaultWiki
Bookmarks