[pmwiki-users] How to do the equivalent of hitting "save" on every page on the wiki?

Alex Eftimiades alexeftimiades at gmail.com
Thu Aug 16 19:37:58 CDT 2012


This seems to work:
if($action=='update'){
   set_time_limit(1800);
   $pages=ListPages();
   foreach($pages as $pn){
     $thispage=ReadPage($pn);
     $oldpage=$thispage;
     foreach($EditAttrFields as $fn=>$fa){
       if ( is_callable(@$fa['filter']) ) $fa['filter']( $pn, $fn,  
$thispage );
     }
     if($thispage!=$oldpage) WritePage($pn,$thispage);
   }
}

This could however be an easy way to develop a DOS attack, so it  
should be limited to certain trusted usernames and/or passwords.

Thanks,
Alex

On Aug 16, 2012, at 2:27 PM, Christopher Cox wrote:

> On 08/16/2012 12:09 PM, Alex Eftimiades wrote:
>> I just added some important new page attributes that will get when  
>> you hit
>> "save" while editing a page. I want to apply them to all the pages  
>> I currently
>> have. I get the feeling this would not be as simple as doing a  
>> "WritePage" to
>> each page on the wiki since that would just rewrite the existing  
>> page.
>>
>> There has to be a way to do this, I just have no idea how to go  
>> about doing so.
>> I restructured my wiki to use these new page variables, so until I  
>> can figure
>> out how to do this, my wiki will not function as intended.
>> This is quite important, so if anyone has any ideas, please respond!
>
> The pmwiki default format is easy to "edit" ... shoot maybe even a  
> perl one-liner would work (if you know how to do such things).
>
> I've done this sort of things many times in the past.... for similar  
> reasons in fact.
>
> But ... I also try to avoid things like say in your last  
> paragraph... "restructured my wiki to use[DEPEND ON] these new page  
> variables".
>
> Could you maybe describe what you are trying to do/accomplish?.. I  
> (we) may be able to suggest a non-disruptive way to handle what you  
> are wanting to do.
>
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users




More information about the pmwiki-users mailing list