From 876cb73709ac2f277e5b734150657d73b2662f50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 12 Jun 2012 20:58:04 +0000 Subject: [PATCH] - update to 20110811 Changed files: dokuwiki-plugin-pagemove-redirectlinks.patch -> 1.3 dokuwiki-plugin-pagemove-selflinks.patch -> 1.3 dokuwiki-plugin-pagemove.spec -> 1.11 --- dokuwiki-plugin-pagemove-redirectlinks.patch | 109 ++++++++++--------- dokuwiki-plugin-pagemove-selflinks.patch | 104 +++++++++--------- dokuwiki-plugin-pagemove.spec | 28 ++--- 3 files changed, 122 insertions(+), 119 deletions(-) diff --git a/dokuwiki-plugin-pagemove-redirectlinks.patch b/dokuwiki-plugin-pagemove-redirectlinks.patch index c3ab7d4..7a74f06 100644 --- a/dokuwiki-plugin-pagemove-redirectlinks.patch +++ b/dokuwiki-plugin-pagemove-redirectlinks.patch @@ -1,57 +1,58 @@ ---- pagemove/admin.php~ 2010-03-22 15:40:57.000000000 +0200 -+++ pagemove/admin.php 2010-03-22 15:42:35.999975148 +0200 -@@ -698,7 +698,8 @@ - function _pm_updatelinks(&$text, $links) - { - foreach( $links as $old => $new ) { -- $text = preg_replace( '#\[\[:?' . $old . '((\]\])|[\|\#])#i', '[[' . $new . '\1', $text); -+ $text = preg_replace( '#\[\[:?' . $old . '(\]\]|[\|\#])#i', '[[' . $new . '\1', $text); -+ $text = preg_replace( '#~~REDIRECT>' . $old . '(~~|[\|\#])#i', '~~REDIRECT>' . $new . '\1', $text); - } +--- dokuwiki-plugin-pagemove-20110811/admin.php~ 2012-06-12 23:38:07.000000000 +0300 ++++ dokuwiki-plugin-pagemove-20110811/admin.php 2012-06-12 23:47:42.513225196 +0300 +@@ -742,7 +742,8 @@ + */ + function _pm_updatelinks(&$text, $links) { + foreach( $links as $old => $new ) { +- $text = preg_replace( '#\[\[:?' . $old . '((\]\])|[\|\#])#i', '[[' . $new . '\1', $text); ++ $text = preg_replace( '#\[\[:?' . $old . '(\]\]|[\|\#])#i', '[[' . $new . '\1', $text); ++ $text = preg_replace( '#~~REDIRECT>' . $old . '(~~|[\|\#])#i', '~~REDIRECT>' . $new . '\1', $text); + } } -@@ -440,7 +441,14 @@ - //match all links - //FIXME may be incorrect because of code blocks - // CamelCase isn't supported, too -- preg_match_all('#\[\[(.+?)\]\]#si',$text,$matches,PREG_SET_ORDER); -+ $matches = array(); -+ if (preg_match_all('#\[\[(.+?)\]\]#s',$text,$m,PREG_SET_ORDER)) { -+ $matches = array_merge($matches, $m); -+ } -+ if (preg_match_all('#~~REDIRECT>(.+?)~~#s',$text,$m,PREG_SET_ORDER)) { -+ $matches = array_merge($matches, $m); -+ } +@@ -772,7 +772,14 @@ + // match all links + // FIXME may be incorrect because of code blocks + // TODO CamelCase isn't supported, too +- preg_match_all('#\[\[(.+?)\]\]#si', $text, $matches, PREG_SET_ORDER); ++ $matches = array(); ++ if (preg_match_all('#\[\[(.+?)\]\]#s', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } ++ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } + - foreach($matches as $match){ - //get ID from link and discard most non wikilinks - list($mid) = split('[\|#]',$match[1],2); -@@ -572,9 +580,9 @@ - */ - function _pm_search_backlinks(&$data,$base,$file,$type,$lvl,$opts){ - //we do nothing with directories -- if($type == 'd') return true;; -+ if($type == 'd') return true; - //only search txt files -- if(!preg_match('#\.txt$#',$file)) return true;; -+ if(!preg_match('#\.txt$#',$file)) return true; - - //get text - $text = io_readfile($base.'/'.$file); ---- pagemove/admin.php~ 2010-03-22 15:44:35.000000000 +0200 -+++ pagemove/admin.php 2010-03-22 15:45:49.644880286 +0200 -@@ -770,7 +770,13 @@ - //match all links - //FIXME may be incorrect because of code blocks - // CamelCase isn't supported, too -- preg_match_all('#{{(.[^>]+?)}}#si',$text,$matches,PREG_SET_ORDER); -+ $matches = array(); -+ if (preg_match_all('#{{(.[^>]+?)}}#si',$text,$matches,PREG_SET_ORDER)) { -+ $matches = array_merge($matches, $m); -+ } -+ if (preg_match_all('#~~REDIRECT>(.+?)~~#s',$text,$m,PREG_SET_ORDER)) { -+ $matches = array_merge($matches, $m); -+ } - foreach($matches as $match){ - //get ID from link and discard most non wikilinks - list($mid) = split('(\?|\|)',$match[1],2); + foreach($matches as $match) { + // ignore local headings [[#some_heading]] + if ( preg_match('/^#/', $match[1])) continue; +@@ -819,7 +819,13 @@ + // match all links + // FIXME may be incorrect because of code blocks + // TODO CamelCase isn't supported, too +- preg_match_all('#{{(.[^>]+?)}}#si', $text, $matches, PREG_SET_ORDER); ++ $matches = array(); ++ if (preg_match_all('#{{(.[^>]+?)}}#si', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } ++ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } + foreach($matches as $match) { + // get ID from link and discard most non wikilinks + list($mid) = split('(\?|\|)', $match[1], 2); +@@ -947,7 +947,13 @@ + // match all links + // FIXME may be incorrect because of code blocks + // FIXME CamelCase isn't supported, too +- preg_match_all('#\[\[(.+?)\]\]#si', $text, $matches, PREG_SET_ORDER); ++ $matches = array(); ++ if (preg_match_all('#\[\[(.+?)\]\]#s', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } ++ if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) { ++ $matches = array_merge($matches, $m); ++ } + foreach($matches as $match) { + // get ID from link and discard most non wikilinks + list($matchLink) = split('[\|#]', $match[1], 2); diff --git a/dokuwiki-plugin-pagemove-selflinks.patch b/dokuwiki-plugin-pagemove-selflinks.patch index abf34a4..74b0755 100644 --- a/dokuwiki-plugin-pagemove-selflinks.patch +++ b/dokuwiki-plugin-pagemove-selflinks.patch @@ -1,65 +1,67 @@ ---- pagemove/admin.php~ 2010-03-22 15:48:44.000000000 +0200 -+++ pagemove/admin.php 2010-03-22 15:52:23.529214700 +0200 -@@ -600,22 +600,36 @@ - //saveWikiText($ID, '', $this->lang['pm_movedto'].$opts['new_id']); - //if (@file_exists(wikiFN($opts['new_id']))) @unlink(wikiFN($ID)); - if (@file_exists(wikiFN($opts['new_id']))) saveWikiText($ID, '',$this->lang['pm_delete'] ); -- +--- dokuwiki-plugin-pagemove-20110811/admin.php~ 2012-06-12 23:48:17.000000000 +0300 ++++ dokuwiki-plugin-pagemove-20110811/admin.php 2012-06-12 23:50:28.916910665 +0300 +@@ -370,10 +370,10 @@ + + // Set things up to display the new page. + io_saveFile($conf['cachedir'].'/purgefile', time()); +- $ID = $opts['new_id']; +- $ACT = 'show'; +- $INFO = pageinfo(); +- $this->show_form = false; + -+ // replace our old id with new one as we already renamed the page but -+ // there might be backlinks (links to self in this case). -+ $opts['id'] = cleanID($opts['ns'].':'.$opts['name']); -+ $selfmod = isset($backlinks[$opts['id']]); -+ if ($selfmod) { ++ // redirect to page display ++ Header("Location: ".wl($opts['new_id'])); ++ exit; + } + else { + $this->errors[] = $this->lang['pm_fatal']; +@@ -618,14 +618,28 @@ + saveWikiText($ID, '', $this->lang['pm_delete'] ); + } + ++ // replace our old id with new one as we already renamed the page but ++ // there might be backlinks (links to self in this case). ++ $opts['id'] = cleanID($opts['ns'].':'.$opts['name']); ++ $selfmod = isset($backlinks[$opts['id']]); ++ if ($selfmod) { + $backlinks[$opts['new_id']] = $backlinks[$opts['id']]; + unset($backlinks[$opts['id']]); -+ } - - //Loop through backlinks - foreach($backlinks as $backlink => $links){ -- $this->_pm_updatebacklinks($backlink, $links, $opts, $brackets); -+ $this->_pm_updatebacklinks($backlink, $links, $opts); - } - - //Move the old revisions - $this->_pm_movemeta('olddir', '/^'.$opts['name'].'\.[0-9]{10}\.txt(\.gz)?$/', $opts); ++ } ++ + // Loop through backlinks + foreach($backlinksById as $backlinkingId => $backlinks) { +- $this->_pm_updatebacklinks($backlinkingId, $backlinks, $opts, $brackets); ++ $this->_pm_updatebacklinks($backlinkingId, $backlinks, $opts); + } -+ // remove cache. again if we ourselves were modified (due backlinks) -+ if ($selfmod) { + // Move the old revisions + $this->_pm_movemeta('olddir', '/^'.$opts['name'].'\.[0-9]{10}\.txt(\.gz)?$/', $opts); + ++ // remove cache. again if we ourselves were modified (due backlinks) ++ if ($selfmod) { + $cache = new cache_instructions($opts['new_id'], wikiFN($opts['new_id'])); + $cache->removeCache(); -+ } -+ - //Set things up to display the new page. - io_saveFile($conf['cachedir'].'/purgefile',time()); -- $ID = $opts['new_id']; -- $ACT = 'show'; -- $INFO = pageinfo(); -- $this->show_form = false; -+ -+ // redirect to page display -+ Header("Location: ".wl($opts['new_id'])); -+ exit; - } - } ++ } } -@@ -352,7 +364,7 @@ + + +@@ -637,7 +637,7 @@ * * @author Gary Owen */ -- function _pm_updatebacklinks($id, $links, $opts, &$brackets) -+ function _pm_updatebacklinks($id, $links, $opts) - { - global $ID; +- function _pm_updatebacklinks($backlinkingId, $links, $opts, &$brackets) { ++ function _pm_updatebacklinks($backlinkingId, $links, $opts) { + global $ID; -@@ -398,8 +410,8 @@ - //Make the changes - $this->_pm_updatelinks($text, $oid); + // Get namespace of document we are editing +@@ -730,8 +730,8 @@ + // Make the changes + $this->_pm_updatelinks($text, $oid); -- //Save backlink and release lock -- saveWikiText($id, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id'])); -+ //Save backlink and release lock. call the edit minor to avoid mail flood on marge backlinks changes -+ saveWikiText($id, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id']), 1); - unlock($id); +- // Save backlink and release lock +- saveWikiText($backlinkingId, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id'])); ++ // Save backlink and release lock. call the edit minor to avoid mail flood on marge backlinks changes ++ saveWikiText($backlinkingId, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id']), 1); + unlock($backlinkingId); } diff --git a/dokuwiki-plugin-pagemove.spec b/dokuwiki-plugin-pagemove.spec index 5542cb9..0c1b0ec 100644 --- a/dokuwiki-plugin-pagemove.spec +++ b/dokuwiki-plugin-pagemove.spec @@ -2,15 +2,15 @@ Summary: DokuWiki PageMove plugin Summary(pl.UTF-8): Wtyczka PageMove dla DokuWiki Name: dokuwiki-plugin-%{plugin} -Version: 0.10.0 +Version: 20110811 Release: 1 License: GPL v2 Group: Applications/WWW -Source0: http://acodeas.de/plugins/Version%{version}-pagemove_20100218.zip -# Source0-md5: 48d2d8dde2794a9a5af5344623d608e8 +Source0: http://github.com/desolat/DokuWiki-Pagemove-Plugin/tarball/master/%{plugin}-%{version}.tgz +# Source0-md5: eff88e845739a9052ac9620d8d2a5056 Patch0: %{name}-redirectlinks.patch Patch1: %{name}-selflinks.patch -URL: http://www.isection.co.uk/doku.php +URL: http://www.dokuwiki.org/plugin:pagemove BuildRequires: sed >= 4.0 BuildRequires: unzip Requires: dokuwiki >= 20060309 @@ -42,9 +42,10 @@ W zupełności można: - wykonać połączenie powyższych. %prep -%setup -q -n %{plugin} -# undos the source -%{__sed} -i -e 's,\r$,,' admin.php +%setup -qc +mv *-DokuWiki-Pagemove-Plugin-*/* . +rm -f *-DokuWiki-Pagemove-Plugin-*/.git* +%undos -f php %patch0 -p1 %patch1 -p1 @@ -60,19 +61,18 @@ rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{plugindir} cp -a . $RPM_BUILD_ROOT%{plugindir} +%{__rm} $RPM_BUILD_ROOT%{plugindir}/README +%{__rm} -r $RPM_BUILD_ROOT%{plugindir}/_test + %clean rm -rf $RPM_BUILD_ROOT -%post -# force css cache refresh -if [ -f %{dokuconf}/local.php ]; then - touch %{dokuconf}/local.php -fi - %files %defattr(644,root,root,755) +%doc README %dir %{plugindir} -%{plugindir}/admin.php +%{plugindir}/*.php +%{plugindir}/*.txt %dir %{plugindir}/lang %{plugindir}/lang/en %lang(cs) %{plugindir}/lang/cs -- 2.44.0