From ee0891d8ffd7e4a59c958b9546a3b8382e4e5991 Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Sun, 14 Nov 2010 14:18:51 -0500 Subject: Do not assume that index files will be backward compatible --- lib/exe/indexer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 3fa81715b..4a6f74ba4 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -140,7 +140,7 @@ function runIndexer(){ // check if indexing needed $idxtag = metaFN($ID,'.indexed'); if(@file_exists($idxtag)){ - if(io_readFile($idxtag) >= INDEXER_VERSION){ + if(trim(io_readFile($idxtag)) == INDEXER_VERSION){ $last = @filemtime($idxtag); if($last > @filemtime(wikiFN($ID))){ print "runIndexer(): index for $ID up to date".NL; -- cgit v1.2.3 From 7c2ef4e8d524fb9262c5a08831220f9fb2dc11fe Mon Sep 17 00:00:00 2001 From: Tom N Harris Date: Wed, 17 Nov 2010 17:02:31 -0500 Subject: Use a different indexer version when external tokenizer is enabled --- lib/exe/indexer.php | 7 ++----- lib/exe/xmlrpc.php | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 4a6f74ba4..55d860296 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -11,9 +11,6 @@ require_once(DOKU_INC.'inc/init.php'); session_write_close(); //close session if(!defined('NL')) define('NL',"\n"); -// Version tag used to force rebuild on upgrade -define('INDEXER_VERSION', 2); - // keep running after browser closes connection @ignore_user_abort(true); @@ -140,7 +137,7 @@ function runIndexer(){ // check if indexing needed $idxtag = metaFN($ID,'.indexed'); if(@file_exists($idxtag)){ - if(trim(io_readFile($idxtag)) == INDEXER_VERSION){ + if(trim(io_readFile($idxtag)) == idx_get_version()){ $last = @filemtime($idxtag); if($last > @filemtime(wikiFN($ID))){ print "runIndexer(): index for $ID up to date".NL; @@ -168,7 +165,7 @@ function runIndexer(){ idx_addPage($ID); // we're finished - save and free lock - io_saveFile(metaFN($ID,'.indexed'),INDEXER_VERSION); + io_saveFile(metaFN($ID,'.indexed'), idx_get_version()); @rmdir($lock); print "runIndexer(): finished".NL; return true; diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index f06792361..410d4f6ba 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -1,7 +1,7 @@ Date: Wed, 29 Dec 2010 03:50:05 -0500 Subject: Indexer v3 Rewrite part two, update uses of indexer --- lib/exe/indexer.php | 35 +---------------------------------- lib/exe/xmlrpc.php | 27 +++------------------------ 2 files changed, 4 insertions(+), 58 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 55d860296..a5a7d6b2a 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -134,41 +134,8 @@ function runIndexer(){ if(!$ID) return false; - // check if indexing needed - $idxtag = metaFN($ID,'.indexed'); - if(@file_exists($idxtag)){ - if(trim(io_readFile($idxtag)) == idx_get_version()){ - $last = @filemtime($idxtag); - if($last > @filemtime(wikiFN($ID))){ - print "runIndexer(): index for $ID up to date".NL; - return false; - } - } - } - - // try to aquire a lock - $lock = $conf['lockdir'].'/_indexer.lock'; - while(!@mkdir($lock,$conf['dmode'])){ - usleep(50); - if(time()-@filemtime($lock) > 60*5){ - // looks like a stale lock - remove it - @rmdir($lock); - print "runIndexer(): stale lock removed".NL; - }else{ - print "runIndexer(): indexer locked".NL; - return false; - } - } - if($conf['dperm']) chmod($lock, $conf['dperm']); - // do the work - idx_addPage($ID); - - // we're finished - save and free lock - io_saveFile(metaFN($ID,'.indexed'), idx_get_version()); - @rmdir($lock); - print "runIndexer(): finished".NL; - return true; + return idx_addPage($ID, true); } /** diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 410d4f6ba..84068f96e 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -355,9 +355,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { */ function listPages(){ $list = array(); - $pages = array_filter(array_filter(idx_getIndex('page', ''), - 'isVisiblePage'), - 'page_exists'); + $pages = idx_get_indexer()->getPages(); + $pages = array_filter(array_filter($pages,'isVisiblePage'),'page_exists'); foreach(array_keys($pages) as $idx) { $perm = auth_quickaclcheck($pages[$idx]); @@ -552,27 +551,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { unlock($id); // run the indexer if page wasn't indexed yet - if(!@file_exists(metaFN($id, '.indexed'))) { - // try to aquire a lock - $lock = $conf['lockdir'].'/_indexer.lock'; - while(!@mkdir($lock,$conf['dmode'])){ - usleep(50); - if(time()-@filemtime($lock) > 60*5){ - // looks like a stale lock - remove it - @rmdir($lock); - }else{ - return false; - } - } - if($conf['dperm']) chmod($lock, $conf['dperm']); - - // do the work - idx_addPage($id); - - // we're finished - save and free lock - io_saveFile(metaFN($id,'.indexed'), idx_get_version()); - @rmdir($lock); - } + idx_addPage($id); return 0; } -- cgit v1.2.3 From c6497d393c535ea8007f277eca65d7083be02159 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 11 Feb 2011 22:23:24 +0100 Subject: avoid warning in linkwizard when a space is entered as query --- lib/exe/ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 1939a7bcb..7d594dc04 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -238,7 +238,7 @@ function ajax_linkwiz(){ global $conf; global $lang; - $q = ltrim($_POST['q'],':'); + $q = ltrim(trim($_POST['q']),':'); $id = noNS($q); $ns = getNS($q); -- cgit v1.2.3 From 318cd03ee91d3a5344bab636a77c3cb19c32c5b7 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 26 Feb 2011 21:22:14 +0000 Subject: improved css.php and core styles * code cleanup in lib/exe/css.php * renamed 'default' userstyle to 'screen' in config_cascade * splitted core lib/styles/style.css up into all.css, print.css and screen.css --- lib/exe/css.php | 61 +++++++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 32 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 4db81de0b..98a34860e 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -30,10 +30,10 @@ function css_out(){ global $lang; global $config_cascade; - $style = ''; + $mediatype = 'screen'; if (isset($_REQUEST['s']) && in_array($_REQUEST['s'], array('all', 'print', 'feed'))) { - $style = $_REQUEST['s']; + $mediatype = $_REQUEST['s']; } $tpl = trim(preg_replace('/[^\w-]+/','',$_REQUEST['t'])); @@ -46,7 +46,7 @@ function css_out(){ } // The generated script depends on some dynamic options - $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$style,'.css'); + $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$mediatype,'.css'); // load template styles $tplstyles = array(); @@ -60,27 +60,29 @@ function css_out(){ // Array of needed files and their web locations, the latter ones // are needed to fix relative paths in the stylesheets $files = array(); - //if (isset($tplstyles['all'])) $files = array_merge($files, $tplstyles['all']); - if(!empty($style)){ - $files[DOKU_INC.'lib/styles/'.$style.'.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles($style)); - if (isset($tplstyles[$style])) $files = array_merge($files, $tplstyles[$style]); - - if(isset($config_cascade['userstyle'][$style])){ - $files[$config_cascade['userstyle'][$style]] = DOKU_BASE; - } - }else{ - $files[DOKU_INC.'lib/styles/style.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles('screen')); - if (isset($tplstyles['screen'])) $files = array_merge($files, $tplstyles['screen']); + // load core styles + $files[DOKU_INC.'lib/styles/'.$mediatype.'.css'] = DOKU_BASE.'lib/styles/'; + // load plugin styles + $files = array_merge($files, css_pluginstyles($mediatype)); + // load template styles + if (isset($tplstyles[$mediatype])) { + $files = array_merge($files, $tplstyles[$mediatype]); + } + // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility + if (isset($config_cascade['userstyle']['default'])) { + $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; + } + // load user styles + if(isset($config_cascade['userstyle'][$mediatype])){ + $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + } + // load rtl styles + // @todo: this currently adds the rtl styles only to the 'screen' media type + // but 'print' and 'all' should also be supported + if ($mediatype=='screen') { if($lang['direction'] == 'rtl'){ if (isset($tplstyles['rtl'])) $files = array_merge($files, $tplstyles['rtl']); } - if(isset($config_cascade['userstyle']['default'])){ - $files[$config_cascade['userstyle']['default']] = DOKU_BASE; - } } // check cache age & handle conditional request @@ -122,7 +124,7 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); - + // place all @import statements at the top of the file $css = css_moveimports($css); @@ -278,20 +280,15 @@ function css_loadfile($file,$location=''){ * * @author Andreas Gohr */ -function css_pluginstyles($mode='screen'){ +function css_pluginstyles($mediatype='screen'){ global $lang; $list = array(); $plugins = plugin_list(); foreach ($plugins as $p){ - if($mode == 'all'){ - $list[DOKU_PLUGIN."$p/all.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'print'){ - $list[DOKU_PLUGIN."$p/print.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'feed'){ - $list[DOKU_PLUGIN."$p/feed.css"] = DOKU_BASE."lib/plugins/$p/"; - }else{ + $list[DOKU_PLUGIN."$p/$mediatype.css"] = DOKU_BASE."lib/plugins/$p/"; + // alternative for screen.css + if ($mediatype=='screen') { $list[DOKU_PLUGIN."$p/style.css"] = DOKU_BASE."lib/plugins/$p/"; - $list[DOKU_PLUGIN."$p/screen.css"] = DOKU_BASE."lib/plugins/$p/"; } if($lang['direction'] == 'rtl'){ $list[DOKU_PLUGIN."$p/rtl.css"] = DOKU_BASE."lib/plugins/$p/"; @@ -302,7 +299,7 @@ function css_pluginstyles($mode='screen'){ /** * Move all @import statements in a combined stylesheet to the top so they - * aren't ignored by the browser. + * aren't ignored by the browser. * * @author Gabriel Birke */ -- cgit v1.2.3 From dea1115b59e771c401882590426074c08fed3a87 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sun, 6 Mar 2011 14:33:50 +0100 Subject: Pass edid to the mediamanager --- lib/exe/mediamanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index 6f2add2be..02fde5a8d 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -91,7 +91,7 @@ if ($res & DOKU_MEDIA_EMPTY_NS) { // current namespace was removed. redirecting to root ns passing msg along send_redirect(DOKU_URL.'lib/exe/mediamanager.php?msg1='. - rawurlencode($msg)); + rawurlencode($msg).'&edid='.$_REQUEST['edid']); } msg($msg,1); } elseif ($res & DOKU_MEDIA_INUSE) { -- cgit v1.2.3 From 7b4ea0818922673113eb39a2062d802b38492186 Mon Sep 17 00:00:00 2001 From: marklundeberg Date: Tue, 8 Mar 2011 21:44:55 -0800 Subject: Make interwiki links match with every other icon-link: need 1px top and bottom padding or else the icons' top and bottom pixel rows get cut off. --- lib/exe/css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 98a34860e..03f900034 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -204,7 +204,7 @@ function css_interwiki(){ // default style echo 'a.interwiki {'; echo ' background: transparent url('.DOKU_BASE.'lib/images/interwiki.png) 0px 1px no-repeat;'; - echo ' padding-left: 16px;'; + echo ' padding: 1px 0px 1px 16px;'; echo '}'; // additional styles when icon available -- cgit v1.2.3