summaryrefslogtreecommitdiff
path: root/inc/parserutils.php
Commit message (Collapse)AuthorAge
* Add missing return value to p_set_metadataMichael Hamann2011-06-08
|
* Add more render/cache logic to the metadata codeMichael Hamann2011-05-08
| | | | | | | | | | | | | | | | | | | | This adds a new rendering limit of currently 5 pages to the p_get_metadata function. This means that in one request not more than 3 pages will be parsed/rendered. Pages for which the cache can be used aren't counted. This should make the new cache modes safe to use and should provide backwards compatibility while keeping the advantage of rendering metadata on demand (i.e. imagine one included page out of 10 is updated, then the metadata for that page can be rendered, but when you request a purge of the cache not 10 pages are rendered). In this commit most of the changes to the p_get_first_heading function are reverted and the title index is no longer used. This makes the first heading functionality no longer depends on the search index of DokuWiki. Maybe it can be added again later when the indexer provides a proper API for getting metadata values for all or selected pages. The performance of the p_get_first_heading function should be almost back to the performance in Anteater as the simple cache of p_get_metadata is used and also the limit of p_get_metadata is of course applied.
* Change when metadata is rendered - only when really neededMichael Hamann2011-05-08
| | | | | | | | | | | | | | | | | | | | | | This changes the cache logic for metadata. It introduces a new mode that tries to avoid rendering the page again for simple requests but still updates the metadata when the page has been changed (but not when the cache timeout has been reached or purge is used). It simply compares the time of the last rendering with the last modified time of the page. The old boolean $render parameter has been changed into an int with three possible values. Compatibility for the old parameter is provided using a check with is_numeric using the following mapping: - false is still don't render (0 is the new value for that) - true is using that new render logic which means that many plugins will still work unchanged even if they request a lot of data using $render=true (1 is the new value for that providing full compatibility in the case 1 has been used instead of true) The default value for p_get_first_heading is now that new simple cache logic, the default value for getting metadata is the cache logic which should be used with care but is the only way to request (rendered) metadata that can change because of plugin installations or upgrades.
* Fix p_get_first_heading for when the search index is emptyMichael Hamann2011-04-26
| | | | | | When the search index is empty, there was a warning and no headings were displayed. Now the headings are displayed and there is no warning anymore.
* p_get_metadata: show the save error message only when metadata has been changedMichael Hamann2011-02-06
|
* Allow p_set_metadata during rendering, test cases included. FS#1827Michael Hamann2011-02-06
|
* Add define for metadata usage limit in p_get_first_headingMichael Hamann2011-01-10
| | | | | | | | | This commit introduces a new define P_GET_FIRST_HEADING_METADATA_LIMIT that can be set in preload.php in order to change the limit for how many pages the first heading shall be loaded from metadata in p_get_first_heading. Changing this is probably most interesting for Wikis with a lot of pages where loading the title index costs a significant amount of time and memory.
* Use title index for more than 11 p_first_heading callsMichael Hamann2011-01-10
| | | | | | | | | | | | | | | | | | This change makes p_get_first_heading load the title index when more than 11 requests that caused a call to p_get_metadata have already been done. This means that small pages and the breadcrums won't trigger the loading of the title index but for larger pages or the sitemap the title index will be used. This is necessary because every call to p_get_metadata can trigger the parsing and rendering of a whole page and there can be many calls when useheading is activated and e.g. the index/sitemap page is displayed. Additionally this adds a small title cache that caches titles requested from p_get_metadata. Further tests should be done how this affects memory usage and how often the index loading is triggered in order to see if that parameter should be adjusted.
* Activate the render parameter of p_get_metadataMichael Hamann2011-01-10
| | | | | | | | | | | | | | | p_get_metadata has a $render parameter that has been disabled by the restructuring of metadata rendering. This change reactivates it so rendering metadata can be prevented. This is e.g. used in the search and in some plugins like indexmenu that use p_get_first_heading. The default of the parameter has been changed to true as otherwise the new caching structure won't work as almost all calls to p_get_metadata don't set the $render parameter. The indexer call to p_get_first_heading has been changed to set $render to true as in the indexer only one page will be rendered and the title in the index should really be the current one. This does not fix the problem that rendering pages with lots of links or displaying the index can cause the parsing/rendering of a lot of pages.
* Save metadata only when really changedMichael Hamann2010-12-27
| | | | | | This avoids disk writes when not needed and possibly also xhtml rendering when the metadata needs to be rendered but xhtml doesn't (unless the metadata file is changed).
* Render metadata when neededMichael Hamann2010-11-22
| | | | | | | | | | | | | | | | | | This changes fundamentally when metadata is rendered. This commit introduces a new cache file for every page that just contains a timestamp and is updated whenever the metadata of that page is rendered. Metadata is rendered when p_get_metadata is called and the last rendering has been before a page, metadata, configuration or renderer update or purge is set like in the xhtml renderer cache. Metadata is no longer automatically rendered when the xhtml renderer cache isn't used but will still be rendered when needed as p_get_metadata is called in the cache. Metadata is also no longer rendered in the indexer script when missing as that is already done by pageinfo() before anything else is done so the indexer script won't be called when there is no metadata file.
* improved some metadata commentsDominik Eckelmann2010-11-13
|
* Introduce metadata write wrapper p_save_metadataAdrian Lang2010-11-13
| | | | p_purge_metadata now updates the metadata cache and the INFO array like the other metadata writing functions
* Remove metadata conversion from 0a7e3bce (2006-11-26)Adrian Lang2010-11-13
|
* - spelling fixesElan Ruusamäe2010-10-07
|
* Allow plugins to specify that they have to be instantiatedAdrian Lang2010-03-29
| | | | | | | | Plugins may return false in isSingleton to let plugin_load return a new instance every time it is called. Renderer plugins are not loaded with $new set to true, but instead specify themself that they are not singletons. This behaviour allows the odt renderer to keep working (see #1598).
* Fix and simplify p_get_metadata key loopingAdrian Lang2010-03-26
| | | | | explode converts $string (false) to string ("") and returns it if $delimiter is not found, therefor looking for the key "" in metadata array.
* Rewrite p_get_metadata to not issue a E_NoticeAdrian Lang2010-03-23
|
* Merge branch 'requireall'Andreas Gohr2010-03-12
|\ | | | | | | | | Conflicts: inc/fulltext.php
| * removed more unneeded require_once() callsAndreas Gohr2010-02-01
| |
| * first attempt to centralize all include loadingAndreas Gohr2010-01-31
| | | | | | | | | | | | | | | | Classes are loaded throug PHP5's class autoloader, all other includes are just loaded by default. This skips a lot of require_once calls. Parser and Plugin stuff isn't handled by the class loader yet.
* | cast 2nd param to array when executing render instructions FS#1880Andreas Gohr2010-02-03
|/
* removed deprecated PHP4 constructAndreas Gohr2010-01-15
| | | | | Assigning the return value of new by reference is deprecated, PHP5's new automatically assigns by reference
* fix for failing plugin check for renderer components (credits go to Michael ↵Gina Haeussge2009-11-06
| | | | | | | | Klier) Ignore-this: 7b2324a14a9069dfc29df54f3eec2d8b darcs-hash:20091106193558-2b4f5-b825e6b0682adb9b5672adb29b0edd26bcc9dbf0.gz
* Coding Standard CleanupAndreas Gohr2009-10-20
| | | | | | Ignore-this: 259cb5773c3144c6c706d87298dcf674 darcs-hash:20091020212338-7ad00-6bf1c5c403491f136a1c02af5ecd9f84d7227107.gz
* Whitespace cleanup FS#1709furun2009-10-16
| | | | | | Ignore-this: 27ea52110bce929b2c61ed8faba67cfc darcs-hash:20091016205526-c0bf4-35eba4e65d37980a667ba982f7f1ea5b7b07f01c.gz
* #FS1767, ensure disabled renderer plugins aren't used for rendereringChris Smith2009-10-04
| | | | | | Ignore-this: a88b14f64c6f6fb827c816214d06c727 darcs-hash:20091004195623-f07c6-d52ce63f5c1f4ad4cf48f78404b3d82f120ccc45.gz
* do not rerender metadata for pages without abstract forever FS#1701Andreas Gohr2009-08-02
| | | | | | Ignore-this: 8ee7f4c5e4ef4f3e66f959dc9bb0c235 darcs-hash:20090802132535-7ad00-05f5712d442f126b2113df44f8252c1ec07c3852.gz
* fixed too strict trim on non-parsed blocksAnika Henke2009-07-16
| | | | darcs-hash:20090715233729-f7d6d-44fc39da1eb65d138e7987f90c613b10978652f8.gz
* further updates to config_cascade patchChris Smith2009-01-22
| | | | | | | | | | - add mediameta and license config files into the cascade - update the cache validity code in cache.php, css.php & js.php to use config_cascade - redo inclusion of main config files to avoid suppression of errors in config files - add getConfigFiles($type) function - minor updates elsewhere to use config_cascade rather than hardcoded config file names darcs-hash:20090122114457-f07c6-98ad5627fd5df93edf8dd03289b9cf6d81962afe.gz
* removed some illogical path setupsAndreas Gohr2008-12-13
| | | | darcs-hash:20081213090400-7ad00-4e21cd75978bb07513f32f5d750658e8d777c59e.gz
* FS#630: allow $conf['useheading'] to individually apply to content links ↵Chris Smith2008-11-19
| | | | | | | | | | | | | | | | and/or navigation links $conf['useheading'] values are now: - 0 : off, use page name in link text - 'content' : use first heading text for links in wiki page content - 'navigation' : use first heading text for links in non-page content, e.g. breadcrumps, backlinks, search results, etc. - 1 : use first heading text in all links (for backwards compatibility, any other values are mapped to 0 or 1 by empty() function.) $conf['useheading'] value should now be checked using the useHeading($linktype) function, where linktype can be "content" or "navigation" darcs-hash:20081119140758-f07c6-6e26456d50dcecc949fada31b0d4e72877fde1cc.gz
* Explicite TypeCast for searchIndexgweissbach2008-08-04
| | | | | | | | | | | Running the /bin/indexer.php or the searchindex plugin fails in php5 with several type cast errors. This can be fixed using explicite type casts. Secondly the include plugin requires the auth.php to be present. As some other plugins might use quick-acl or the $auth too, indexer.php should require the auth.php just as the lib/exe/indexer.php does. darcs-hash:20080804112444-f4337-e12f25329236689b05e31f0db2119e47660a9404.gz
* add third parameter to plugin_load(), $new, to allow return of a new plugin ↵Chris Smith2008-08-13
| | | | | | object instance darcs-hash:20080813125929-f07c6-4f20e147334ebc5be006ec9f260331950ac2e4cb.gz
* fixed typo :-/Andreas Gohr2008-05-02
| | | | darcs-hash:20080502132023-7ad00-5c2e017926ac7966c940f214e3c31fbf7c54dcea.gz
* correctly expire the cache for geshi highlighted stringsAndreas Gohr2008-05-02
| | | | darcs-hash:20080502130234-7ad00-ddd191945f838db2cbdd6f6a0fda2a6e034a2205.gz
* call io_readWikiPage() instead of io_readfile() on page loadGalaxyMaster2008-04-17
| | | | | | | | | A patch to call IO_READ_WIKIPAGE properly. Without this patch any plugin which wants to intercept IO_READ_WIKIPAGE will catch almost nothing. darcs-hash:20080417205233-ae67a-6a82f5c7e84e3b669bab5ecf062abbaad4406d4d.gz
* Fix for FS#1350Chris Smith2008-03-29
| | | | | | | | | | | | | Inline modes, <php> and <html>, when their associated config setting is off, will generate highlighted text wrapped in a <code> element. There is a slight change in behaviour for p_xhtml_cached_geshi(), it will now strip leading and trailing blank lines from the input code string. Also fixes an issue where global $conf wasn't declared, preventing the ['target']['extern'] setting being passed to GeSHi darcs-hash:20080329194443-f07c6-00db3d502b07a6ff0c7f6e5c74a3691438504bcb.gz
* purge non-persistent meta data on page deletionMichael Klier2008-03-26
| | | | | | | | With this patch applied the persistent meta data of pages is kept when a page is deleted. This way the original page creator as well as the creation time of the page is preserved. darcs-hash:20080326200231-23886-ddb70151fadf25d0254d56408b71484047198096.gz
* Add support for plugin renderers to replace standard renderersChris Smith2008-03-12
| | | | | | | | | | | | | | | | | | | This patch is the fourth in a series aimed at making it easier for DW to allow plugins to modify the standard handling of line-breaks. It adds: - new config setting 'renderer_xhtml', default value 'xhtml' - new renderer method 'reset()' which is used by reusable renderers when used to render second and subsequent data. (*) An extra step has been added to the renderer selection process. - check $conf["renderer_$mode] for renderer name. If it doesn't exist use $mode as the renderer name. (*) It maybe that the 'document_start()' method can be used for this. However the current xhtml does not correctly reset itself for reuse. darcs-hash:20080312005647-f07c6-ff2cb960c05927f5c6f3e916a364fcad470c2ce3.gz
* Fix for FS#1334, see also FS#1090Chris Smith2008-02-23
| | | | | | | | | FS#1090 ensured DW would never rebuild instructions in the same run by forcing subsequent instruction requests to use the version cached on the first request. That introduced problems when the caching of the instructions failed (FS#1334). This patch allows subsequent rebuilds when cache storage failed. darcs-hash:20080223025539-d26fc-26202a049a6969816553d950a2bb8f71a02ae76e.gz
* make sure $ID is set correct when rendering metadataAndreas Gohr2008-02-08
| | | | darcs-hash:20080208212733-7ad00-b111663f6397e220beac70b9f54bdffd0d8c2760.gz
* header support for renderer pluginsAndreas Gohr2007-10-16
| | | | | | | Renderer plugins now can store HTTP header information in 'format <mode>' which will be used to send their output. Also fixes a problem with loading cache files. darcs-hash:20071016185626-7ad00-c0e18a90b310daf0d3a3c01d7a73f3524ced803d.gz
* fixes for p_get_metadata() & p_set_metadata (incl. resolution of FS#1254)Chris Smith2007-09-30
| | | | | | | - add page existence check to prevent attempts to render metadata for non-existent pages (FS#1254) - add key & subkey existence checks to avoid PHP warnings darcs-hash:20070930022739-d26fc-e3688478e7c4d7be9080220c7f470d41c34d2cd7.gz
* don't use realpath() anymore (FS#1261 and others)Andreas Gohr2007-09-30
| | | | | | | | | | | The use of realpath() to clean up relative file names caused some trouble in certain setups relying on symlinks or having restricitve file structure setups. This patch replaces all realpath() calls with a PHP only replacement which should solve those problems. darcs-hash:20070930184250-7ad00-512ff04c95f57fc9eaf104f80372237a3c94286f.gz
* Don't create bogus blank entries in metadataTom N Harris2007-09-19
| | | | darcs-hash:20070919194756-6942e-0986b3711e370a91d8b42665a94c6866ba56811c.gz
* alter p_get_first_heading() default $render value to trueChris Smith2007-08-21
| | | | | | | | | | | | Calls to p_get_first_heading() are most likely to expect to get the first heading even if it needs to be generated, that is a $render value of true. Only the metadata renderer itself needs a value of false in order to prevent mutual dependency probelms. This fix should finally complete FS#1010 & problems breadcrumbs have with use_first_headings when metadata doesn't exist. Also see, http://www.freelists.org/archives/dokuwiki/08-2007/msg00018.html & http://www.freelists.org/archives/dokuwiki/08-2007/msg00132.html darcs-hash:20070821021008-d26fc-e08a23b4eb40f075de043687b57eb1223b0201b9.gz
* separated TOC from pageAndreas Gohr2007-08-05
| | | | | | | | | | | | | | | | | | This patch introduces a tpl_toc() function which can be used to freely place the Table of Contents in a template. When used, tpl_content should be called with a parameter of false to supress the automatic TOC placement. Note: if tpl_toc() us run *before* tpl_content(), TOCs will not work in the preview. A work around is to run tpl_content() in a output buffer first. This patch also adds a getTOC() function for admin plugins which allows plugin authors to put create their own TOC which will be placed correctly in the template. A convenience function html_mktocitem() is available. The config manager was adjusted to make ue of this new feature, but some bugs might remain. darcs-hash:20070805132405-7ad00-77d2c3cdf66cc62b2d408cc6580f938636a109af.gz
* added getFormat() function to rendererAndreas Gohr2007-03-03
| | | | | | | | | | | Each renderer has to supply a getFormat() function returning the format it produces. Usually this is the same as the classname of the renderer (or Plugin) says but it does not need to be necessarily. Fixes a problem with the wrong format being reported to plugins when a render plugin was used. darcs-hash:20070303214102-7ad00-3f87d8a10e94f4c6c30bacc8f43486b94ecdb146.gz
* never build instructions twice in the same run FS#1090Andreas Gohr2007-03-03
| | | | | | When a page was called with purge darcs-hash:20070303202232-7ad00-03e05dc32646563688307ae51b6594d223bad938.gz