From: <ru...@us...> - 2009-01-07 08:56:51
|
Revision: 6373 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6373&view=rev Author: rurban Date: 2009-01-07 08:56:46 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Protect against "Cannot create references to/from string offsets nor overloaded objects" Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2009-01-07 08:54:19 UTC (rev 6372) +++ trunk/lib/WikiDB.php 2009-01-07 08:56:46 UTC (rev 6373) @@ -1251,8 +1251,8 @@ * E.g. "owner.users" * <dt>'perm' <dd> Permission flag to authorize read/write/execution of * page-headers and content. - + <dt>'moderation'<dd> ModeratedPage data - * <dt>'score' <dd> Page score (not yet implement, do we need?) + + <dt>'moderation'<dd> ModeratedPage data. Handled by plugin/ModeratedPage + * <dt>'rating' <dd> Page rating. Handled by plugin/RateIt * </dl> * * @return scalar The requested value, or false if the requested data @@ -2174,8 +2174,11 @@ $vdata = $this->_backend->get_versiondata($pagename, $version, $need_content); $readdata = true; } - if ($readdata && $vdata && !empty($vdata['%pagedata'])) { - $this->_pagedata_cache[$pagename] =& $vdata['%pagedata']; + if ($readdata && is_array($vdata) && !empty($vdata['%pagedata'])) { + if (empty($this->_pagedata_cache)) + $this->_pagedata_cache = array(); + /* PHP Fatal error: Cannot create references to/from string offsets nor overloaded objects in /var/www/html/phpwiki/lib/WikiDB.php on line 2180, referer: wiki/TitleSearch?s=and&auto_redirect=1 */ + $this->_pagedata_cache[$pagename] = $vdata['%pagedata']; } return $vdata; } @@ -2245,476 +2248,6 @@ _sql_debuglog('',false,true); } -// $Log: not supported by cvs2svn $ -// Revision 1.159 2008/03/22 21:51:11 rurban -// check for ENABLE_MAILNOTIFY -// -// Revision 1.158 2008/01/30 19:29:52 vargenau -// Disabled to avoid recursive modification when renaming a page like 'PageFoo to 'PageFooTwo' -// -// Revision 1.157 2007/09/15 12:35:50 rurban -// basic array reset support - unclear if needed, iteration is usually one-time only -// -// Revision 1.156 2007/09/12 19:38:05 rurban -// fix wrong ref ¤t -// -// Revision 1.155 2007/07/15 17:39:33 rurban -// stabilize rename updateWikiLinks to check only words -// -// Revision 1.154 2007/07/14 12:03:58 rurban -// support score -// -// Revision 1.153 2007/06/07 16:54:29 rurban -// enable $MailNotify->onChangePage. support other formatters (MediaWiki, Creole, ...) -// -// Revision 1.152 2007/05/28 20:13:46 rurban -// Overwrite all attributes at once at page->save to delete dangling meta -// -// Revision 1.151 2007/05/01 16:20:12 rurban -// MailNotify->onChangePage only on DEBUG (still broken) -// -// Revision 1.150 2007/03/18 17:35:27 rurban -// Improve comments -// -// Revision 1.149 2007/02/17 14:16:37 rurban -// isWikiPage no error on empty pagenames. MailNotify->onChangePage fix by ?? -// -// Revision 1.148 2007/01/27 21:53:03 rurban -// Use TEMP_DIR for debug sql.log -// -// Revision 1.147 2007/01/04 16:41:41 rurban -// Some pageiterators also set ['pagedata']['linkrelation'], hmm -// -// Revision 1.146 2007/01/02 13:20:00 rurban -// rewrote listRelations. added linkSearch. force new date in renamePage. fix fortune error handling. added page->setAttributes. use translated initial owner. Clarify API: sortby,limit and exclude are strings. Enhance documentation. -// -// Revision 1.145 2006/12/22 17:59:55 rurban -// Move mailer functions into seperate MailNotify.php -// -// Revision 1.144 2006/10/12 06:36:09 rurban -// Guard against unwanted DEBUG="DEBUG" logic. In detail (WikiDB), -// and generally by forcing all int constants to be defined as int. -// -// Revision 1.143 2006/09/06 05:46:40 rurban -// do db backend check on _DEBUG_SQL -// -// Revision 1.142 2006/06/10 11:55:58 rurban -// print optimize only when DEBUG -// -// Revision 1.141 2006/04/17 17:28:21 rurban -// honor getWikiPageLinks change linkto=>relation -// -// Revision 1.140 2006/03/19 14:23:51 rurban -// sf.net patch #1377011 by Matt Brown: add DATABASE_OPTIMISE_FREQUENCY -// -// Revision 1.139 2006/01/12 16:38:07 rurban -// add page method listRelations() -// fix bug #1327912 numeric pagenames can break plugins (Joachim Lous) -// -// Revision 1.138 2005/11/14 22:27:07 rurban -// add linkrelation support -// getPageLinks returns now an array of hashes -// pass stoplist through iterator -// -// Revision 1.137 2005/10/12 06:16:18 rurban -// better From header -// -// Revision 1.136 2005/10/03 16:14:57 rurban -// improve description -// -// Revision 1.135 2005/09/11 14:19:44 rurban -// enable LIMIT support for fulltext search -// -// Revision 1.134 2005/09/10 21:28:10 rurban -// applyFilters hack to use filters after methods, which do not support them (titleSearch) -// -// Revision 1.133 2005/08/27 09:39:10 rurban -// dumphtml when not at admin page: dump the current or given page -// -// Revision 1.132 2005/08/07 10:10:07 rurban -// clean whole version cache -// -// Revision 1.131 2005/04/23 11:30:12 rurban -// allow emtpy WikiDB::getRevisionBefore(), for simplier templates (revert) -// -// Revision 1.130 2005/04/06 06:19:30 rurban -// Revert the previous wrong bugfix #1175761: USECACHE was mixed with WIKIDB_NOCACHE_MARKUP. -// Fix WIKIDB_NOCACHE_MARKUP in main (always set it) and clarify it in WikiDB -// -// Revision 1.129 2005/04/06 05:50:29 rurban -// honor !USECACHE for _cached_html, fixes #1175761 -// -// Revision 1.128 2005/04/01 16:11:42 rurban -// just whitespace -// -// Revision 1.127 2005/02/18 20:43:40 uckelman -// WikiDB::genericWarnings() is no longer used. -// -// Revision 1.126 2005/02/04 17:58:06 rurban -// minor versioncache improvement. part 2/3 of Charles Corrigan cache patch. not sure about the 0/1 issue -// -// Revision 1.125 2005/02/03 05:08:39 rurban -// ref fix by Charles Corrigan -// -// Revision 1.124 2005/01/29 20:43:32 rurban -// protect against empty request: on some occasion this happens -// -// Revision 1.123 2005/01/25 06:58:21 rurban -// reformatting -// -// Revision 1.122 2005/01/20 10:18:17 rurban -// reformatting -// -// Revision 1.121 2005/01/04 20:25:01 rurban -// remove old [%pagedata][_cached_html] code -// -// Revision 1.120 2004/12/23 14:12:31 rurban -// dont email on unittest -// -// Revision 1.119 2004/12/20 16:05:00 rurban -// gettext msg unification -// -// Revision 1.118 2004/12/13 13:22:57 rurban -// new BlogArchives plugin for the new blog theme. enable default box method -// for all plugins. Minor search improvement. -// -// Revision 1.117 2004/12/13 08:15:09 rurban -// false is wrong. null might be better but lets play safe. -// -// Revision 1.116 2004/12/10 22:15:00 rurban -// fix $page->get('_cached_html) -// refactor upgrade db helper _convert_cached_html() to be able to call them from WikiAdminUtils also. -// support 2nd genericSqlQuery param (bind huge arg) -// -// Revision 1.115 2004/12/10 02:45:27 rurban -// SQL optimization: -// put _cached_html from pagedata into a new seperate blob, not huge serialized string. -// it is only rarelely needed: for current page only, if-not-modified -// but was extracted for every simple page iteration. -// -// Revision 1.114 2004/12/09 22:24:44 rurban -// optimize on _DEBUG_SQL only. but now again on every 50th request, not just save. -// -// Revision 1.113 2004/12/06 19:49:55 rurban -// enable action=remove which is undoable and seeable in RecentChanges: ADODB ony for now. -// renamed delete_page to purge_page. -// enable action=edit&version=-1 to force creation of a new version. -// added BABYCART_PATH config -// fixed magiqc in adodb.inc.php -// and some more docs -// -// Revision 1.112 2004/11/30 17:45:53 rurban -// exists_links backend implementation -// -// Revision 1.111 2004/11/28 20:39:43 rurban -// deactivate pagecache overwrite: it is wrong -// -// Revision 1.110 2004/11/26 18:39:01 rurban -// new regex search parser and SQL backends (90% complete, glob and pcre backends missing) -// -// Revision 1.109 2004/11/25 17:20:50 rurban -// and again a couple of more native db args: backlinks -// -// Revision 1.108 2004/11/23 13:35:31 rurban -// add case_exact search -// -// Revision 1.107 2004/11/21 11:59:16 rurban -// remove final \n to be ob_cache independent -// -// Revision 1.106 2004/11/20 17:35:56 rurban -// improved WantedPages SQL backends -// PageList::sortby new 3rd arg valid_fields (override db fields) -// WantedPages sql pager inexact for performance reasons: -// assume 3 wantedfrom per page, to be correct, no getTotal() -// support exclude argument for get_all_pages, new _sql_set() -// -// Revision 1.105 2004/11/20 09:16:27 rurban -// Fix bad-style Cut&Paste programming errors, detected by Charles Corrigan. -// -// Revision 1.104 2004/11/19 19:22:03 rurban -// ModeratePage part1: change status -// -// Revision 1.103 2004/11/16 17:29:04 rurban -// fix remove notification error -// fix creation + update id_cache update -// -// Revision 1.102 2004/11/11 18:31:26 rurban -// add simple backtrace on such general failures to get at least an idea where -// -// Revision 1.101 2004/11/10 19:32:22 rurban -// * optimize increaseHitCount, esp. for mysql. -// * prepend dirs to the include_path (phpwiki_dir for faster searches) -// * Pear_DB version logic (awful but needed) -// * fix broken ADODB quote -// * _extract_page_data simplification -// -// Revision 1.100 2004/11/10 15:29:20 rurban -// * requires newer Pear_DB (as the internal one): quote() uses now escapeSimple for strings -// * ACCESS_LOG_SQL: fix cause request not yet initialized -// * WikiDB: moved SQL specific methods upwards -// * new Pear_DB quoting: same as ADODB and as newer Pear_DB. -// fixes all around: WikiGroup, WikiUserNew SQL methods, SQL logging -// -// Revision 1.99 2004/11/09 17:11:05 rurban -// * revert to the wikidb ref passing. there's no memory abuse there. -// * use new wikidb->_cache->_id_cache[] instead of wikidb->_iwpcache, to effectively -// store page ids with getPageLinks (GleanDescription) of all existing pages, which -// are also needed at the rendering for linkExistingWikiWord(). -// pass options to pageiterator. -// use this cache also for _get_pageid() -// This saves about 8 SELECT count per page (num all pagelinks). -// * fix passing of all page fields to the pageiterator. -// * fix overlarge session data which got broken with the latest ACCESS_LOG_SQL changes -// -// Revision 1.98 2004/11/07 18:34:29 rurban -// more logging fixes -// -// Revision 1.97 2004/11/07 16:02:51 rurban -// new sql access log (for spam prevention), and restructured access log class -// dbh->quote (generic) -// pear_db: mysql specific parts seperated (using replace) -// -// Revision 1.96 2004/11/05 22:32:15 rurban -// encode the subject to be 7-bit safe -// -// Revision 1.95 2004/11/05 20:53:35 rurban -// login cleanup: better debug msg on failing login, -// checked password less immediate login (bogo or anon), -// checked olduser pref session error, -// better PersonalPage without password warning on minimal password length=0 -// (which is default now) -// -// Revision 1.94 2004/11/01 10:43:56 rurban -// seperate PassUser methods into seperate dir (memory usage) -// fix WikiUser (old) overlarge data session -// remove wikidb arg from various page class methods, use global ->_dbi instead -// ... -// -// Revision 1.93 2004/10/14 17:17:57 rurban -// remove dbi WikiDB_Page param: use global request object instead. (memory) -// allow most_popular sortby arguments -// -// Revision 1.92 2004/10/05 17:00:04 rurban -// support paging for simple lists -// fix RatingDb sql backend. -// remove pages from AllPages (this is ListPages then) -// -// Revision 1.91 2004/10/04 23:41:19 rurban -// delete notify: fix, @unset syntax error -// -// Revision 1.90 2004/09/28 12:50:22 rurban -// https://sourceforge.net/forum/forum.php?thread_id=1150924&forum_id=18929 -// -// Revision 1.89 2004/09/26 10:54:42 rurban -// silence deferred check -// -// Revision 1.88 2004/09/25 18:16:40 rurban -// unset more unneeded _cached_html. (Guess this should fix sf.net now) -// -// Revision 1.87 2004/09/25 16:25:40 rurban -// notify on rename and remove (to be improved) -// -// Revision 1.86 2004/09/23 18:52:06 rurban -// only fortune at create -// -// Revision 1.85 2004/09/16 08:00:51 rurban -// just some comments -// -// Revision 1.84 2004/09/14 10:34:30 rurban -// fix TransformedText call to use refs -// -// Revision 1.83 2004/09/08 13:38:00 rurban -// improve loadfile stability by using markup=2 as default for undefined markup-style. -// use more refs for huge objects. -// fix debug=static issue in WikiPluginCached -// -// Revision 1.82 2004/09/06 12:08:49 rurban -// memory_limit on unix workaround -// VisualWiki: default autosize image -// -// Revision 1.81 2004/09/06 08:28:00 rurban -// rename genericQuery to genericSqlQuery -// -// Revision 1.80 2004/07/09 13:05:34 rurban -// just aesthetics -// -// Revision 1.79 2004/07/09 10:06:49 rurban -// Use backend specific sortby and sortable_columns method, to be able to -// select between native (Db backend) and custom (PageList) sorting. -// Fixed PageList::AddPageList (missed the first) -// Added the author/creator.. name to AllPagesBy... -// display no pages if none matched. -// Improved dba and file sortby(). -// Use &$request reference -// -// Revision 1.78 2004/07/08 21:32:35 rurban -// Prevent from more warnings, minor db and sort optimizations -// -// Revision 1.77 2004/07/08 19:04:42 rurban -// more unittest fixes (file backend, metadata RatingsDb) -// -// Revision 1.76 2004/07/08 17:31:43 rurban -// improve numPages for file (fixing AllPagesTest) -// -// Revision 1.75 2004/07/05 13:56:22 rurban -// sqlite autoincrement fix -// -// Revision 1.74 2004/07/03 16:51:05 rurban -// optional DBADMIN_USER:DBADMIN_PASSWD for action=upgrade (if no ALTER permission) -// added atomic mysql REPLACE for PearDB as in ADODB -// fixed _lock_tables typo links => link -// fixes unserialize ADODB bug in line 180 -// -// Revision 1.73 2004/06/29 08:52:22 rurban -// Use ...version() $need_content argument in WikiDB also: -// To reduce the memory footprint for larger sets of pagelists, -// we don't cache the content (only true or false) and -// we purge the pagedata (_cached_html) also. -// _cached_html is only cached for the current pagename. -// => Vastly improved page existance check, ACL check, ... -// -// Now only PagedList info=content or size needs the whole content, esp. if sortable. -// -// Revision 1.72 2004/06/25 14:15:08 rurban -// reduce memory footprint by caching only requested pagedate content (improving most page iterators) -// -// Revision 1.71 2004/06/21 16:22:30 rurban -// add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps, -// fixed dumping buttons locally (images/buttons/), -// support pages arg for dumphtml, -// optional directory arg for dumpserial + dumphtml, -// fix a AllPages warning, -// show dump warnings/errors on DEBUG, -// don't warn just ignore on wikilens pagelist columns, if not loaded. -// RateIt pagelist column is called "rating", not "ratingwidget" (Dan?) -// -// Revision 1.70 2004/06/18 14:39:31 rurban -// actually check USECACHE -// -// Revision 1.69 2004/06/13 15:33:20 rurban -// new support for arguments owner, author, creator in most relevant -// PageList plugins. in WikiAdmin* via preSelectS() -// -// Revision 1.68 2004/06/08 21:03:20 rurban -// updated RssParser for XmlParser quirks (store parser object params in globals) -// -// Revision 1.67 2004/06/07 19:12:49 rurban -// fixed rename version=0, bug #966284 -// -// Revision 1.66 2004/06/07 18:57:27 rurban -// fix rename: Change pagename in all linked pages -// -// Revision 1.65 2004/06/04 20:32:53 rurban -// Several locale related improvements suggested by Pierrick Meignen -// LDAP fix by John Cole -// reanable admin check without ENABLE_PAGEPERM in the admin plugins -// -// Revision 1.64 2004/06/04 16:50:00 rurban -// add random quotes to empty pages -// -// Revision 1.63 2004/06/04 11:58:38 rurban -// added USE_TAGLINES -// -// Revision 1.62 2004/06/03 22:24:41 rurban -// reenable admin check on !ENABLE_PAGEPERM, honor s=Wildcard arg, fix warning after Remove -// -// Revision 1.61 2004/06/02 17:13:48 rurban -// fix getRevisionBefore assertion -// -// Revision 1.60 2004/05/28 10:09:58 rurban -// fix bug #962117, incorrect init of auth_dsn -// -// Revision 1.59 2004/05/27 17:49:05 rurban -// renamed DB_Session to DbSession (in CVS also) -// added WikiDB->getParam and WikiDB->getAuthParam method to get rid of globals -// remove leading slash in error message -// added force_unlock parameter to File_Passwd (no return on stale locks) -// fixed adodb session AffectedRows -// added FileFinder helpers to unify local filenames and DATA_PATH names -// editpage.php: new edit toolbar javascript on ENABLE_EDIT_TOOLBAR -// -// Revision 1.58 2004/05/18 13:59:14 rurban -// rename simpleQuery to genericQuery -// -// Revision 1.57 2004/05/16 22:07:35 rurban -// check more config-default and predefined constants -// various PagePerm fixes: -// fix default PagePerms, esp. edit and view for Bogo and Password users -// implemented Creator and Owner -// BOGOUSERS renamed to BOGOUSER -// fixed syntax errors in signin.tmpl -// -// Revision 1.56 2004/05/15 22:54:49 rurban -// fixed important WikiDB bug with DEBUG > 0: wrong assertion -// improved SetAcl (works) and PagePerms, some WikiGroup helpers. -// -// Revision 1.55 2004/05/12 19:27:47 rurban -// revert wrong inline optimization. -// -// Revision 1.54 2004/05/12 10:49:55 rurban -// require_once fix for those libs which are loaded before FileFinder and -// its automatic include_path fix, and where require_once doesn't grok -// dirname(__FILE__) != './lib' -// upgrade fix with PearDB -// navbar.tmpl: remove spaces for IE button alignment -// -// Revision 1.53 2004/05/08 14:06:12 rurban -// new support for inlined image attributes: [image.jpg size=50x30 align=right] -// minor stability and portability fixes -// -// Revision 1.52 2004/05/06 19:26:16 rurban -// improve stability, trying to find the InlineParser endless loop on sf.net -// -// remove end-of-zip comments to fix sf.net bug #777278 and probably #859628 -// -// Revision 1.51 2004/05/06 17:30:37 rurban -// CategoryGroup: oops, dos2unix eol -// improved phpwiki_version: -// pre -= .0001 (1.3.10pre: 1030.099) -// -p1 += .001 (1.3.9-p1: 1030.091) -// improved InstallTable for mysql and generic SQL versions and all newer tables so far. -// abstracted more ADODB/PearDB methods for action=upgrade stuff: -// backend->backendType(), backend->database(), -// backend->listOfFields(), -// backend->listOfTables(), -// -// Revision 1.50 2004/05/04 22:34:25 rurban -// more pdf support -// -// Revision 1.49 2004/05/03 11:16:40 rurban -// fixed sendPageChangeNotification -// subject rewording -// -// Revision 1.48 2004/04/29 23:03:54 rurban -// fixed sf.net bug #940996 -// -// Revision 1.47 2004/04/29 19:39:44 rurban -// special support for formatted plugins (one-liners) -// like <small><plugin BlaBla ></small> -// iter->asArray() helper for PopularNearby -// db_session for older php's (no &func() allowed) -// -// Revision 1.46 2004/04/26 20:44:34 rurban -// locking table specific for better databases -// -// Revision 1.45 2004/04/20 00:06:03 rurban -// themable paging support -// -// Revision 1.44 2004/04/19 18:27:45 rurban -// Prevent from some PHP5 warnings (ref args, no :: object init) -// php5 runs now through, just one wrong XmlElement object init missing -// Removed unneccesary UpgradeUser lines -// Changed WikiLink to omit version if current (RecentChanges) -// -// Revision 1.43 2004/04/18 01:34:20 rurban -// protect most_popular from sortby=mtime -// -// Revision 1.42 2004/04/18 01:11:51 rurban -// more numeric pagename fixes. -// fixed action=upload with merge conflict warnings. -// charset changed from constant to global (dynamic utf-8 switching) -// - // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-07-14 07:13:06
|
Revision: 7025 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7025&view=rev Author: rurban Date: 2009-07-14 07:12:58 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Performance: Do not check RECENTCHANGESBOX cache on actions not using it Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2009-07-14 07:11:38 UTC (rev 7024) +++ trunk/lib/WikiDB.php 2009-07-14 07:12:58 UTC (rev 7025) @@ -1030,7 +1030,11 @@ $newrevision->_transformedContent = $formatted; } // more pagechange callbacks: (in a hackish manner for now) - if (ENABLE_RECENTCHANGESBOX and empty($meta['is_minor_edit'])) { + if (ENABLE_RECENTCHANGESBOX + and empty($meta['is_minor_edit']) + and !in_array($GLOBALS['request']->getArg('action'), + array('loadfile','upgrade'))) + { require_once("lib/WikiPlugin.php"); $w = new WikiPluginLoader; $p = $w->getPlugin("RecentChangesCached", false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-08-31 10:59:07
|
Revision: 7092 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7092&view=rev Author: rurban Date: 2009-08-31 10:58:59 +0000 (Mon, 31 Aug 2009) Log Message: ----------- omit debugging notice: undefined readonly Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2009-08-27 19:38:42 UTC (rev 7091) +++ trunk/lib/WikiDB.php 2009-08-31 10:58:59 UTC (rev 7092) @@ -216,7 +216,7 @@ * @see purgePage */ function deletePage($pagename) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } // don't create empty revisions of already purged pages. if ($this->_backend->get_latest_version($pagename)) $result = $this->_cache->delete_page($pagename); @@ -249,7 +249,7 @@ * @see deletePage */ function purgePage($pagename) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $result = $this->_cache->purge_page($pagename); $this->deletePage($pagename); // just for the notification return $result; @@ -519,7 +519,7 @@ * @return boolean true or false */ function renamePage($from, $to, $updateWikiLinks = false) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } assert(is_string($from) && $from != ''); assert(is_string($to) && $to != ''); $result = false; @@ -671,7 +671,7 @@ * @param string $newval New value. */ function set($key, $newval) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } if (!$key || $key[0] == '%') return; @@ -2130,7 +2130,7 @@ function update_pagedata($pagename, $newdata) { assert(is_string($pagename) && $pagename != ''); - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $this->_backend->update_pagedata($pagename, $newdata); @@ -2155,14 +2155,14 @@ } function delete_page($pagename) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $result = $this->_backend->delete_page($pagename); $this->invalidate_cache($pagename); return $result; } function purge_page($pagename) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $result = $this->_backend->purge_page($pagename); $this->invalidate_cache($pagename); return $result; @@ -2215,7 +2215,7 @@ function set_versiondata($pagename, $version, $data) { //unset($this->_versiondata_cache[$pagename][$version]); - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $new = $this->_backend->set_versiondata($pagename, $version, $data); // Update the cache $this->_versiondata_cache[$pagename][$version]['1'] = $data; @@ -2225,7 +2225,7 @@ } function update_versiondata($pagename, $version, $data) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $new = $this->_backend->update_versiondata($pagename, $version, $data); // Update the cache $this->_versiondata_cache[$pagename][$version]['1'] = $data; @@ -2236,7 +2236,7 @@ } function delete_versiondata($pagename, $version) { - if ($this->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); return; } $new = $this->_backend->delete_versiondata($pagename, $version); if (isset($this->_versiondata_cache[$pagename][$version])) unset ($this->_versiondata_cache[$pagename][$version]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2009-09-16 08:45:12
|
Revision: 7124 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7124&view=rev Author: rurban Date: 2009-09-16 08:45:06 +0000 (Wed, 16 Sep 2009) Log Message: ----------- hasDefaultContents: allow not-empty page content "0" Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2009-09-16 08:23:59 UTC (rev 7123) +++ trunk/lib/WikiDB.php 2009-09-16 08:45:06 UTC (rev 7124) @@ -1481,7 +1481,9 @@ { //var $_transformedContent = false; // set by WikiDB_Page::save() - function WikiDB_PageRevision(&$wikidb, $pagename, $version, $versiondata = false) { + function WikiDB_PageRevision(&$wikidb, $pagename, $version, + $versiondata = false) + { $this->_wikidb = &$wikidb; $this->_pagename = $pagename; $this->_version = $version; @@ -1527,7 +1529,9 @@ */ function hasDefaultContents() { $data = &$this->_data; - return empty($data['%content']); // FIXME: what if it's the number 0? <>'' or === false + if (!isset($data['%content'])) return true; + if ($data['%content'] === true) return false; + return $data['%content'] === false or $data['%content'] === ""; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ru...@us...> - 2010-06-08 08:22:28
|
Revision: 7492 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7492&view=rev Author: rurban Date: 2010-06-08 08:22:22 +0000 (Tue, 08 Jun 2010) Log Message: ----------- relations might be empty now Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2010-06-08 08:19:42 UTC (rev 7491) +++ trunk/lib/WikiDB.php 2010-06-08 08:22:22 UTC (rev 7492) @@ -1,6 +1,4 @@ -<?php //-*-php-*- -// rcs_id('$Id$'); - +<?php //rcs_id('$Id$'); require_once('lib/PageType.php'); /** @@ -1004,7 +1002,7 @@ $links = $formatted->getWikiPageLinks(); // linkto => relation $attributes = array(); foreach ($links as $link) { - if ($link['linkto'] === "" and $link['relation']) { + if ($link['linkto'] === "" and !empty($link['relation'])) { $attributes[$link['relation']] = $this->getAttribute($link['relation']); } } @@ -1818,7 +1816,7 @@ $this->_iter = $iter; // a WikiDB_backend_iterator $this->_wikidb = &$wikidb; $this->_options = $options; - } + } function count () { return $this->_iter->count(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-04-11 08:07:10
|
Revision: 8030 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8030&view=rev Author: vargenau Date: 2011-04-11 08:07:04 +0000 (Mon, 11 Apr 2011) Log Message: ----------- Avoid warning Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2011-04-08 15:01:21 UTC (rev 8029) +++ trunk/lib/WikiDB.php 2011-04-11 08:07:04 UTC (rev 8030) @@ -1328,7 +1328,10 @@ return; // values identical, skip update. } - if ($this->_wikidb->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } + if (isset($this->_wikidb->readonly) and ($this->_wikidb->readonly)) { + trigger_error("readonly database", E_USER_WARNING); + return; + } $cache->update_pagedata($pagename, array($key => $newval)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-05-04 10:22:57
|
Revision: 8063 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8063&view=rev Author: vargenau Date: 2011-05-04 10:22:51 +0000 (Wed, 04 May 2011) Log Message: ----------- Test 0 to be sure Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2011-05-04 10:22:03 UTC (rev 8062) +++ trunk/lib/WikiDB.php 2011-05-04 10:22:51 UTC (rev 8063) @@ -1077,8 +1077,9 @@ $cache = &$this->_wikidb->_cache; $pagename = &$this->_pagename; - if (! $version or $version == -1) // 0 or false + if ((!$version) or ($version == 0) or ($version == -1)) { // 0 or false return new WikiDB_PageRevision($this->_wikidb, $pagename, 0); + } assert($version > 0); $vdata = $cache->get_versiondata($pagename, $version, $need_content); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-06-01 12:17:52
|
Revision: 8088 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8088&view=rev Author: vargenau Date: 2011-06-01 12:17:46 +0000 (Wed, 01 Jun 2011) Log Message: ----------- This is not an error if include_empty=1 in AllPages Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2011-05-20 14:29:42 UTC (rev 8087) +++ trunk/lib/WikiDB.php 2011-06-01 12:17:46 UTC (rev 8088) @@ -1817,24 +1817,15 @@ * @return WikiDB_Page The next WikiDB_Page in the sequence. */ function next () { - if ( ! ($next = $this->_iter->next()) ) + if ( ! ($next = $this->_iter->next()) ) { return false; + } $pagename = &$next['pagename']; - if (!is_string($pagename)) { // Bug #1327912 fixed by Joachim Lous - /*if (is_array($pagename) && isset($pagename['linkto'])) { - $pagename = $pagename['linkto']; - } - $pagename = strval($pagename);*/ + if (!is_string($pagename)) { // Bug #1327912 fixed by Joachim Lous trigger_error("WikiDB_PageIterator->next pagename", E_USER_WARNING); - } - if (!$pagename) { - if (isset($next['linkrelation']) - or isset($next['pagedata']['linkrelation'])) return false; - trigger_error('empty pagename in WikiDB_PageIterator::next()', E_USER_WARNING); - var_dump($next); - return false; } + // There's always hits, but we cache only if more // (well not with file, cvs and dba) if (isset($next['pagedata']) and count($next['pagedata']) > 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-06-01 12:21:32
|
Revision: 8089 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8089&view=rev Author: vargenau Date: 2011-06-01 12:21:26 +0000 (Wed, 01 Jun 2011) Log Message: ----------- This is not an error if include_empty=1 in AllPages Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2011-06-01 12:17:46 UTC (rev 8088) +++ trunk/lib/WikiDB.php 2011-06-01 12:21:26 UTC (rev 8089) @@ -1826,6 +1826,13 @@ trigger_error("WikiDB_PageIterator->next pagename", E_USER_WARNING); } + if (!$pagename) { + if (isset($next['linkrelation']) + or isset($next['pagedata']['linkrelation'])) { + return false; + } + } + // There's always hits, but we cache only if more // (well not with file, cvs and dba) if (isset($next['pagedata']) and count($next['pagedata']) > 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-01-16 20:05:36
|
Revision: 8231 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8231&view=rev Author: vargenau Date: 2012-01-16 20:05:30 +0000 (Mon, 16 Jan 2012) Log Message: ----------- Whitespace only Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2012-01-11 14:16:33 UTC (rev 8230) +++ trunk/lib/WikiDB.php 2012-01-16 20:05:30 UTC (rev 8231) @@ -127,7 +127,7 @@ // devel checking. if ((int)DEBUG & _DEBUG_SQL) { $this->_backend->check(); - } + } // might be changed when opening the database fails $this->readonly = defined("READONLY") ? READONLY : false; } @@ -476,24 +476,24 @@ function listRelations($also_attributes=false, $only_attributes=false, $sorted=true) { if (method_exists($this->_backend, "list_relations")) return $this->_backend->list_relations($also_attributes, $only_attributes, $sorted); - // dumb, slow fallback. no iter, so simply define it here. + // dumb, slow fallback. no iter, so simply define it here. $relations = array(); $iter = $this->getAllPages(); while ($page = $iter->next()) { $reliter = $page->getRelations(); $names = array(); while ($rel = $reliter->next()) { - // if there's no pagename it's an attribute + // if there's no pagename it's an attribute $names[] = $rel->getName(); } $relations = array_merge($relations, $names); $reliter->free(); } $iter->free(); - if ($sorted) { - sort($relations); - reset($relations); - } + if ($sorted) { + sort($relations); + reset($relations); + } return $relations; } @@ -517,16 +517,16 @@ //update all WikiLinks in existing pages //non-atomic! i.e. if rename fails the links are not undone if ($updateWikiLinks) { - $lookbehind = "/(?<=[\W:])\Q"; - $lookahead = "\E(?=[\W:])/"; + $lookbehind = "/(?<=[\W:])\Q"; + $lookahead = "\E(?=[\W:])/"; require_once('lib/plugin/WikiAdminSearchReplace.php'); $links = $oldpage->getBackLinks(); while ($linked_page = $links->next()) { WikiPlugin_WikiAdminSearchReplace::replaceHelper - ($this, - $linked_page->getName(), - $lookbehind.$from.$lookahead, $to, - true, true); + ($this, + $linked_page->getName(), + $lookbehind.$from.$lookahead, $to, + true, true); } // FIXME: Disabled to avoid recursive modification when renaming // a page like 'PageFoo to 'PageFooTwo' @@ -549,7 +549,7 @@ $meta = $current->_data; $version = $current->getVersion(); $meta['summary'] = sprintf(_("renamed from %s"), $from); - unset($meta['mtime']); // force new date + unset($meta['mtime']); // force new date $page->save($current->getPackedContent(), $version + 1, $meta); } } elseif (!$oldpage->getCurrentRevision(false) and !$newpage->exists()) { @@ -937,8 +937,8 @@ $data['mtime'] = $pdata['mtime']; } - // FIXME: use (possibly user specified) 'mtime' time or - // time()? + // FIXME: use (possibly user specified) 'mtime' time or + // time()? $cache->update_versiondata($pagename, $latestversion, array('_supplanted' => $data['mtime'])); } @@ -975,11 +975,11 @@ */ function save($wikitext, $version, $meta, $formatted = null) { if ($this->_wikidb->readonly) { trigger_error("readonly database", E_USER_WARNING); return; } - if (is_null($formatted)) - $formatted = new TransformedText($this, $wikitext, $meta); + if (is_null($formatted)) + $formatted = new TransformedText($this, $wikitext, $meta); $type = $formatted->getType(); - $meta['pagetype'] = $type->getName(); - $links = $formatted->getWikiPageLinks(); // linkto => relation + $meta['pagetype'] = $type->getName(); + $links = $formatted->getWikiPageLinks(); // linkto => relation $attributes = array(); foreach ($links as $link) { if ($link['linkto'] === "" and !empty($link['relation'])) { @@ -988,13 +988,13 @@ } $meta['attribute'] = $attributes; - $backend = &$this->_wikidb->_backend; - $newrevision = $this->createRevision($version, $wikitext, $meta, $links); - if ($newrevision and !WIKIDB_NOCACHE_MARKUP) + $backend = &$this->_wikidb->_backend; + $newrevision = $this->createRevision($version, $wikitext, $meta, $links); + if ($newrevision and !WIKIDB_NOCACHE_MARKUP) $this->set('_cached_html', $formatted->pack()); - // FIXME: probably should have some global state information - // in the backend to control when to optimize. + // FIXME: probably should have some global state information + // in the backend to control when to optimize. // // We're doing this here rather than in createRevision because // postgresql can't optimize while locked. @@ -1012,12 +1012,12 @@ // Save didn't fail because of concurrent updates. $notify = $this->_wikidb->get('notify'); if (!empty($notify) - and is_array($notify) - and !isa($GLOBALS['request'],'MockRequest')) - { + and is_array($notify) + and !isa($GLOBALS['request'],'MockRequest')) + { include_once("lib/MailNotify.php"); $MailNotify = new MailNotify($newrevision->getName()); - $MailNotify->onChangePage ($this->_wikidb, $wikitext, $version, $meta); + $MailNotify->onChangePage ($this->_wikidb, $wikitext, $version, $meta); } $newrevision->_transformedContent = $formatted; } @@ -1032,7 +1032,7 @@ $p = $w->getPlugin("RecentChangesCached", false); $p->box_update(false, $GLOBALS['request'], $this->_pagename); } - return $newrevision; + return $newrevision; } /** @@ -1567,18 +1567,18 @@ * contents. */ function getTransformedContent($pagetype_override=false) { - $backend = &$this->_wikidb->_backend; + $backend = &$this->_wikidb->_backend; - if ($pagetype_override) { - // Figure out the normal page-type for this page. + if ($pagetype_override) { + // Figure out the normal page-type for this page. $type = PageType::GetPageType($this->get('pagetype')); - if ($type->getName() == $pagetype_override) - $pagetype_override = false; // Not really an override... - } + if ($type->getName() == $pagetype_override) + $pagetype_override = false; // Not really an override... + } if ($pagetype_override) { // Overriden page type, don't cache (or check cache). - return new TransformedText($this->getPage(), + return new TransformedText($this->getPage(), $this->getPackedContent(), $this->getMetaData(), $pagetype_override); @@ -1604,7 +1604,7 @@ $possibly_cache_results = false; } //$backend->unlock(); - } + } if (!$this->_transformedContent) { $this->_transformedContent @@ -1650,15 +1650,15 @@ { include_once("lib/fortune.php"); $fortune = new Fortune(); - $quote = $fortune->quoteFromDir(FORTUNE_DIR); - if ($quote != -1) - $quote = "<verbatim>\n" - . str_replace("\n<br>","\n", $quote) - . "</verbatim>\n\n"; - else - $quote = ""; + $quote = $fortune->quoteFromDir(FORTUNE_DIR); + if ($quote != -1) + $quote = "<verbatim>\n" + . str_replace("\n<br>","\n", $quote) + . "</verbatim>\n\n"; + else + $quote = ""; return $quote - . sprintf(_("Describe %s here."), + . sprintf(_("Describe %s here."), "[" . WikiEscape($this->_pagename) . "]"); } // Replace empty content with default value. @@ -2165,7 +2165,7 @@ function get_versiondata($pagename, $version, $need_content = false) { // FIXME: Seriously ugly hackage $readdata = false; - if (USECACHE) { //temporary - for debugging + if (USECACHE) { //temporary - for debugging assert(is_string($pagename) && $pagename != ''); // There is a bug here somewhere which results in an assertion failure at line 105 // of ArchiveCleaner.php It goes away if we use the next line. @@ -2186,10 +2186,10 @@ } } $vdata = $cache[$pagename][$version][$nc]; - } else { + } else { $vdata = $this->_backend->get_versiondata($pagename, $version, $need_content); $readdata = true; - } + } if ($readdata && is_array($vdata) && !empty($vdata['%pagedata'])) { if (empty($this->_pagedata_cache)) $this->_pagedata_cache = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-14 15:47:19
|
Revision: 8439 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8439&view=rev Author: vargenau Date: 2012-11-14 15:47:08 +0000 (Wed, 14 Nov 2012) Log Message: ----------- Remove empty lines Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2012-11-14 15:45:07 UTC (rev 8438) +++ trunk/lib/WikiDB.php 2012-11-14 15:47:08 UTC (rev 8439) @@ -755,9 +755,6 @@ } } - - - /** * A base class which representing a wiki-page within a * WikiDB. @@ -1539,8 +1536,6 @@ } - - /** * This class represents a specific revision of a WikiDB_Page within * a WikiDB. @@ -1888,9 +1883,6 @@ } } - - - /** * Class representing a sequence of WikiDB_Pages. * TODO: Enhance to php5 iterators @@ -2046,8 +2038,6 @@ } - - /** * A class which represents a sequence of WikiDB_PageRevisions. * TODO: Enhance to php5 iterators @@ -2134,8 +2124,6 @@ } } - - /** pseudo iterator */ class WikiDB_Array_PageIterator @@ -2431,8 +2419,6 @@ } } - - function _sql_debuglog($msg, $newline = true, $shutdown = false) { static $fp = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-06 18:04:00
|
Revision: 8616 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8616&view=rev Author: vargenau Date: 2012-12-06 17:52:46 +0000 (Thu, 06 Dec 2012) Log Message: ----------- printSimpleTrace is void Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2012-12-06 17:51:18 UTC (rev 8615) +++ trunk/lib/WikiDB.php 2012-12-06 17:52:46 UTC (rev 8616) @@ -720,7 +720,9 @@ // returns the generic iterator object (count,next) function genericSqlIter($sql, $field_list = NULL) { - echo "<pre>", printSimpleTrace(debug_backtrace()), "</pre>\n"; + echo "<pre>"; + printSimpleTrace(debug_backtrace()); + echo "</pre>\n"; trigger_error("no SQL database", E_USER_ERROR); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-12-19 20:19:15
|
Revision: 8684 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8684&view=rev Author: vargenau Date: 2012-12-19 20:19:09 +0000 (Wed, 19 Dec 2012) Log Message: ----------- void printSimpleTrace Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2012-12-19 13:53:05 UTC (rev 8683) +++ trunk/lib/WikiDB.php 2012-12-19 20:19:09 UTC (rev 8684) @@ -711,7 +711,9 @@ // returns the database specific resource type function genericSqlQuery($sql, $args = false) { - echo "<pre>", printSimpleTrace(debug_backtrace()), "</pre>\n"; + echo "<pre>"; + printSimpleTrace(debug_backtrace()); + echo "</pre>\n"; trigger_error("no SQL database", E_USER_ERROR); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2013-06-19 13:28:38
|
Revision: 8820 http://sourceforge.net/p/phpwiki/code/8820 Author: vargenau Date: 2013-06-19 13:28:34 +0000 (Wed, 19 Jun 2013) Log Message: ----------- Avoid fatal error in ListRelations Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2013-06-19 13:25:45 UTC (rev 8819) +++ trunk/lib/WikiDB.php 2013-06-19 13:28:34 UTC (rev 8820) @@ -1969,7 +1969,7 @@ */ function free() { - $this->_iter->free(); + // $this->_iter->free(); } function reset() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-09-29 12:58:42
|
Revision: 9131 http://sourceforge.net/p/phpwiki/code/9131 Author: vargenau Date: 2014-09-29 12:58:35 +0000 (Mon, 29 Sep 2014) Log Message: ----------- Update PHP Doc Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-09-29 12:27:30 UTC (rev 9130) +++ trunk/lib/WikiDB.php 2014-09-29 12:58:35 UTC (rev 9131) @@ -1797,7 +1797,7 @@ /** * Get all the revision page meta-data as a hash. * - * @return hash The revision meta-data. + * @return array The revision meta-data. */ function getMetaData() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-11-17 16:22:51
|
Revision: 9324 http://sourceforge.net/p/phpwiki/code/9324 Author: vargenau Date: 2014-11-17 16:22:48 +0000 (Mon, 17 Nov 2014) Log Message: ----------- PHP Doc; add static; fix return Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-11-17 15:59:00 UTC (rev 9323) +++ trunk/lib/WikiDB.php 2014-11-17 16:22:48 UTC (rev 9324) @@ -47,7 +47,7 @@ * arguments to determine the proper subclass of WikiDB to * instantiate, and then it instantiates it. * - * @param hash $dbparams Database configuration parameters. + * @param array $dbparams Database configuration parameters (hash). * Some pertinent parameters are: * <dl> * <dt> dbtype @@ -96,7 +96,7 @@ * * @return WikiDB A WikiDB object. **/ - public function open($dbparams) + static public function open($dbparams) { $dbtype = $dbparams{'dbtype'}; include_once("lib/WikiDB/$dbtype.php"); @@ -213,7 +213,7 @@ { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } // don't create empty revisions of already purged pages. if ($this->_backend->get_latest_version($pagename)) @@ -243,13 +243,14 @@ /** * Completely remove the page from the WikiDB, without undo possibility. * @param string $pagename Name of page to delete. + * @return bool * @see deletePage */ public function purgePage($pagename) { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } $result = $this->_cache->purge_page($pagename); $this->deletePage($pagename); // just for the notification @@ -507,7 +508,7 @@ { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } assert(is_string($from) && $from != ''); assert(is_string($to) && $to != ''); @@ -610,7 +611,7 @@ function set_db_version($ver) { - return $this->set('_db_version', (float)$ver); + $this->set('_db_version', (float)$ver); } /** @@ -625,7 +626,7 @@ * <dt>'_timestamp' <dd> Data used by getTimestamp(). * </dl> * - * @return scalar The requested value, or false if the requested data + * @return mixed The requested value, or false if the requested data * is not set. */ public function get($key) @@ -754,7 +755,7 @@ printSimpleTrace(debug_backtrace()); } trigger_error("empty pagename", E_USER_WARNING); - return false; + return; } } else { assert(is_string($pagename) and $pagename != ''); @@ -905,10 +906,10 @@ * * @param string $content Contents of new revision. * - * @param hash $metadata Metadata for new revision. + * @param array $metadata Metadata for new revision (hash). * All values in the hash should be scalars (strings or integers). * - * @param hash $links List of linkto=>pagename, relation=>pagename which this page links to. + * @param array $links List of linkto=>pagename, relation=>pagename which this page links to (hash). * * @return WikiDB_PageRevision Returns the new WikiDB_PageRevision object. If * $version was incorrect, returns false @@ -917,7 +918,7 @@ { if ($this->_wikidb->readonly) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } $backend = &$this->_wikidb->_backend; $cache = &$this->_wikidb->_cache; @@ -1004,7 +1005,7 @@ { if ($this->_wikidb->readonly) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } if (is_null($formatted)) $formatted = new TransformedText($this, $wikitext, $meta); @@ -1076,7 +1077,6 @@ */ public function getCurrentRevision($need_content = true) { - $backend = &$this->_wikidb->_backend; $cache = &$this->_wikidb->_cache; $pagename = &$this->_pagename; @@ -1208,8 +1208,7 @@ /** * All Links from other pages to this page. */ - function getBackLinks($include_empty = false, $sortby = '', $limit = '', $exclude = '', - $want_relations = false) + function getBackLinks($include_empty = false, $sortby = '', $limit = '', $exclude = '') { return $this->getLinks(true, $include_empty, $sortby, $limit, $exclude); } @@ -1217,8 +1216,7 @@ /** * Forward Links: All Links from this page to other pages. */ - function getPageLinks($include_empty = false, $sortby = '', $limit = '', $exclude = '', - $want_relations = false) + function getPageLinks($include_empty = false, $sortby = '', $limit = '', $exclude = '') { return $this->getLinks(false, $include_empty, $sortby, $limit, $exclude); } @@ -1293,7 +1291,7 @@ * <dt>'rating' <dd> Page rating. Handled by plugin/RateIt * </dl> * - * @return scalar The requested value, or false if the requested data + * @return mixed The requested value, or false if the requested data * is not set. */ public function get($key) @@ -1316,7 +1314,7 @@ /** * Get all the page meta-data as a hash. * - * @return hash The page meta-data. + * @return array The page meta-data (hash). */ function getMetaData() { @@ -1357,7 +1355,8 @@ trigger_error("readonly database", E_USER_WARNING); return; } - return $backend->set_cached_html($pagename, $newval); + $backend->set_cached_html($pagename, $newval); + return; } $data = $cache->get_pagedata($pagename); @@ -1614,8 +1613,6 @@ */ function getTransformedContent($pagetype_override = false) { - $backend = &$this->_wikidb->_backend; - if ($pagetype_override) { // Figure out the normal page-type for this page. $type = PageType::GetPageType($this->get('pagetype')); @@ -2230,7 +2227,7 @@ { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } $result = $this->_backend->delete_page($pagename); $this->invalidate_cache($pagename); @@ -2241,7 +2238,7 @@ { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); - return; + return false; } $result = $this->_backend->purge_page($pagename); $this->invalidate_cache($pagename); @@ -2302,7 +2299,7 @@ trigger_error("readonly database", E_USER_WARNING); return; } - $new = $this->_backend->set_versiondata($pagename, $version, $data); + $this->_backend->set_versiondata($pagename, $version, $data); // Update the cache $this->_versiondata_cache[$pagename][$version]['1'] = $data; $this->_versiondata_cache[$pagename][$version]['0'] = $data; @@ -2316,7 +2313,7 @@ trigger_error("readonly database", E_USER_WARNING); return; } - $new = $this->_backend->update_versiondata($pagename, $version, $data); + $this->_backend->update_versiondata($pagename, $version, $data); // Update the cache $this->_versiondata_cache[$pagename][$version]['1'] = $data; // FIXME: hack @@ -2331,7 +2328,7 @@ trigger_error("readonly database", E_USER_WARNING); return; } - $new = $this->_backend->delete_versiondata($pagename, $version); + $this->_backend->delete_versiondata($pagename, $version); if (isset($this->_versiondata_cache[$pagename][$version])) unset ($this->_versiondata_cache[$pagename][$version]); // dirty latest version cache only if latest version gets deleted This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-11-23 19:58:31
|
Revision: 9365 http://sourceforge.net/p/phpwiki/code/9365 Author: vargenau Date: 2014-11-23 19:58:23 +0000 (Sun, 23 Nov 2014) Log Message: ----------- Type compatibility Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-11-23 18:26:27 UTC (rev 9364) +++ trunk/lib/WikiDB.php 2014-11-23 19:58:23 UTC (rev 9365) @@ -102,7 +102,7 @@ include_once("lib/WikiDB/$dbtype.php"); $class = 'WikiDB_' . $dbtype; - return new $class ($dbparams); + return new $class($dbparams); } /** @@ -1128,8 +1128,7 @@ * This method find the most recent revision before a specified * version. * - * @param bool|int $version Find most recent revision before this version. - * You can also use a WikiDB_PageRevision object to specify the $version. + * @param bool|int|WikiDB_PageRevision $version Find most recent revision before this version. * * @param bool $need_content * @@ -1834,7 +1833,7 @@ */ class WikiDB_PageIterator { - function WikiDB_PageIterator(&$wikidb, &$iter, $options = false) + function WikiDB_PageIterator(&$wikidb, &$iter, $options = array()) { $this->_iter = $iter; // a WikiDB_backend_iterator $this->_wikidb = &$wikidb; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-02 14:26:55
|
Revision: 9404 http://sourceforge.net/p/phpwiki/code/9404 Author: vargenau Date: 2014-12-02 14:26:47 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Add class variables Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-12-02 13:41:37 UTC (rev 9403) +++ trunk/lib/WikiDB.php 2014-12-02 14:26:47 UTC (rev 9404) @@ -41,6 +41,37 @@ class WikiDB { /** + * @see open() + */ + function __construct(&$backend, $dbparams) + { + /** + * @var WikiRequest $request + */ + global $request; + + $this->_backend =& $backend; + // don't do the following with the auth_dsn! + if (isset($dbparams['auth_dsn'])) + return; + + $this->_cache = new WikiDB_cache($backend); + if (!empty($request)) + $request->_dbi = $this; + + // If the database doesn't yet have a timestamp, initialize it now. + if ($this->get('_timestamp') === false) + $this->touch(); + + // devel checking. + if ((int)DEBUG & _DEBUG_SQL) { + $this->_backend->check(); + } + // might be changed when opening the database fails + $this->readonly = defined("READONLY") ? READONLY : false; + } + + /** * Open a WikiDB database. * * This function inspects its arguments to determine the proper @@ -105,35 +136,6 @@ } /** - * @see open() - */ - function __construct(&$backend, $dbparams) - { - /** - * @var WikiRequest $request - */ - global $request; - - $this->_backend =& $backend; - // don't do the following with the auth_dsn! - if (isset($dbparams['auth_dsn'])) return; - - $this->_cache = new WikiDB_cache($backend); - if (!empty($request)) $request->_dbi = $this; - - // If the database doesn't yet have a timestamp, initialize it now. - if ($this->get('_timestamp') === false) - $this->touch(); - - // devel checking. - if ((int)DEBUG & _DEBUG_SQL) { - $this->_backend->check(); - } - // might be changed when opening the database fails - $this->readonly = defined("READONLY") ? READONLY : false; - } - - /** * Close database connection. * * The database may no longer be used after it is closed. @@ -602,7 +604,6 @@ /** * Update the database timestamp. - * */ function touch() { @@ -721,10 +722,8 @@ function isOpen() { - global $request; - if (!$request->_dbi) return false; - else return false; /* so far only needed for sql so false it. - later we have to check dba also */ + return false; /* so far only needed for sql so false it. + later we have to check dba also */ } function getParam($param) @@ -761,7 +760,11 @@ */ class WikiDB_Page { - function WikiDB_Page(&$wikidb, $pagename) + public $score; + public $_wikidb; + public $_pagename; + + function __construct(&$wikidb, $pagename) { $this->_wikidb = &$wikidb; $this->_pagename = $pagename; @@ -997,8 +1000,7 @@ $backend->unlock(array('version', 'page', 'recent', 'link', 'nonempty')); - return new WikiDB_PageRevision($this->_wikidb, $pagename, $newversion, - $data); + return new WikiDB_PageRevision($this->_wikidb, $pagename, $newversion, $data); } /** A higher-level interface to createRevision. @@ -1489,15 +1491,19 @@ // The authenticated author of the first revision or empty if not authenticated then. function getCreator() { - if ($current = $this->getRevision(1, false)) return $current->get('author_id'); - else return ''; + if ($current = $this->getRevision(1, false)) + return $current->get('author_id'); + else + return ''; } // The authenticated author of the current revision. function getAuthor() { - if ($current = $this->getCurrentRevision(false)) return $current->get('author_id'); - else return ''; + if ($current = $this->getCurrentRevision(false)) + return $current->get('author_id'); + else + return ''; } /* Semantic Web value, not stored in the links. @@ -1534,10 +1540,13 @@ */ class WikiDB_PageRevision { + public $_wikidb; + public $_pagename; + public $_version; + public $_data; public $_transformedContent = false; // set by WikiDB_Page::save() - function WikiDB_PageRevision(&$wikidb, $pagename, $version, - $versiondata = false) + function __construct(&$wikidb, $pagename, $version, $versiondata = array()) { $this->_wikidb = &$wikidb; $this->_pagename = $pagename; @@ -1559,7 +1568,7 @@ /** * Get the version number of this revision. * - * @return integer The version number of this revision. + * @return int The version number of this revision. */ public function getVersion() { @@ -1862,7 +1871,11 @@ */ class WikiDB_PageIterator { - function WikiDB_PageIterator(&$wikidb, &$iter, $options = array()) + public $_iter; + public $_wikidb; + public $_options; + + function __construct(&$wikidb, &$iter, $options = array()) { $this->_iter = $iter; // a WikiDB_backend_iterator $this->_wikidb = &$wikidb; @@ -2010,7 +2023,11 @@ */ class WikiDB_PageRevisionIterator { - function WikiDB_PageRevisionIterator(&$wikidb, &$revisions, $options = false) + public $_revisions; + public $_wikidb; + public $_options; + + function __construct(&$wikidb, &$revisions, $options = false) { $this->_revisions = $revisions; $this->_wikidb = &$wikidb; @@ -2057,8 +2074,7 @@ } } else assert($version > 0); - return new WikiDB_PageRevision($this->_wikidb, $pagename, $version, - $versiondata); + return new WikiDB_PageRevision($this->_wikidb, $pagename, $version, $versiondata); } /** @@ -2090,9 +2106,16 @@ */ class WikiDB_Array_PageIterator { - function WikiDB_Array_PageIterator($pagenames) + public $_dbi; + public $_pages; + + function __construct ($pagenames) { + /** + * @var WikiRequest $request + */ global $request; + $this->_dbi = $request->getDbh(); $this->_pages = $pagenames; reset($this->_pages); @@ -2128,7 +2151,9 @@ class WikiDB_Array_generic_iter { - function WikiDB_Array_generic_iter($result) + public $_array; + + function __construct($result) { // $result may be either an array or a query result if (is_array($result)) { @@ -2182,7 +2207,14 @@ { // FIXME: beautify versiondata cache. Cache only limited data? - function WikiDB_cache(&$backend) + public $_backend; + public $_pagedata_cache; + public $_versiondata_cache; + public $_glv_cache; + public $_id_cache; + public $readonly; + + function __construct(&$backend) { /** * @var WikiRequest $request @@ -2190,7 +2222,6 @@ global $request; $this->_backend = &$backend; - $this->_pagedata_cache = array(); $this->_versiondata_cache = array(); array_push($this->_versiondata_cache, array()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-12-02 15:09:09
|
Revision: 9405 http://sourceforge.net/p/phpwiki/code/9405 Author: vargenau Date: 2014-12-02 15:09:06 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Type compatibility Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2014-12-02 14:26:47 UTC (rev 9404) +++ trunk/lib/WikiDB.php 2014-12-02 15:09:06 UTC (rev 9405) @@ -747,7 +747,7 @@ elseif ($param == 'USER_AUTH_POLICY') return $GLOBALS['USER_AUTH_POLICY']; else - return false; + return array(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-14 15:35:17
|
Revision: 9476 http://sourceforge.net/p/phpwiki/code/9476 Author: vargenau Date: 2015-01-14 15:35:08 +0000 (Wed, 14 Jan 2015) Log Message: ----------- Add new function getVersion for class WikiDB_Page Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2015-01-14 15:15:14 UTC (rev 9475) +++ trunk/lib/WikiDB.php 2015-01-14 15:35:08 UTC (rev 9476) @@ -810,6 +810,13 @@ return !$current->hasDefaultContents(); } + public function getVersion() + { + $backend = &$this->_wikidb->_backend; + $pagename = &$this->_pagename; + return $backend->get_latest_version($pagename); + } + /** * Delete an old revision of a WikiDB_Page. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-03-06 09:52:13
|
Revision: 9610 http://sourceforge.net/p/phpwiki/code/9610 Author: vargenau Date: 2015-03-06 09:52:06 +0000 (Fri, 06 Mar 2015) Log Message: ----------- Add public Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2015-03-05 18:30:15 UTC (rev 9609) +++ trunk/lib/WikiDB.php 2015-03-06 09:52:06 UTC (rev 9610) @@ -1519,7 +1519,7 @@ /* Semantic Web value, not stored in the links. * todo: unify with some unit knowledge */ - function setAttribute($relation, $value) + public function setAttribute($relation, $value) { $attr = $this->get('attributes'); if (empty($attr)) @@ -1626,7 +1626,7 @@ return $this->_pagename; } - function getName() + public function getName() { return $this->_pagename; } @@ -2329,7 +2329,7 @@ unset($this->_glv_cache[$pagename]); } - function update_versiondata($pagename, $version, $data) + public function update_versiondata($pagename, $version, $data) { if (!empty($this->readonly)) { trigger_error("readonly database", E_USER_WARNING); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2019-04-18 16:14:55
|
Revision: 10105 http://sourceforge.net/p/phpwiki/code/10105 Author: vargenau Date: 2019-04-18 16:14:53 +0000 (Thu, 18 Apr 2019) Log Message: ----------- trigger_error("readonly database") only in DEBUG mode Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2019-04-18 15:37:23 UTC (rev 10104) +++ trunk/lib/WikiDB.php 2019-04-18 16:14:53 UTC (rev 10105) @@ -247,7 +247,9 @@ public function deletePage($pagename) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } // don't create empty revisions of already purged pages. @@ -284,7 +286,9 @@ public function purgePage($pagename) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } $result = $this->_cache->purge_page($pagename); @@ -547,7 +551,9 @@ global $request; if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } assert(is_string($from) && $from != ''); @@ -699,7 +705,9 @@ public function set($key, $newval) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } if (!$key || $key[0] == '%') @@ -853,7 +861,9 @@ public function deleteRevision($version) { if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $backend = &$this->_wikidb->_backend; @@ -907,7 +917,9 @@ public function mergeRevision($version) { if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $backend = &$this->_wikidb->_backend; @@ -975,7 +987,9 @@ public function createRevision($version, &$content, $metadata, $links) { if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } $backend = &$this->_wikidb->_backend; @@ -1066,7 +1080,9 @@ global $request; if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } if (is_null($formatted)) @@ -1412,7 +1428,9 @@ and method_exists($backend, 'set_cached_html') ) { if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $backend->set_cached_html($pagename, $newval); @@ -1430,7 +1448,9 @@ } if (isset($this->_wikidb->readonly) and ($this->_wikidb->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $cache->update_pagedata($pagename, array($key => $newval)); @@ -1453,7 +1473,9 @@ public function increaseHitCount() { if ($this->_wikidb->readonly) { - trigger_error("readonly database", E_USER_NOTICE); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_NOTICE); + } return; } if (method_exists($this->_wikidb->_backend, 'increaseHitCount')) @@ -2243,7 +2265,9 @@ { assert(is_string($pagename) && $pagename != ''); if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } @@ -2273,7 +2297,9 @@ public function delete_page($pagename) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } $result = $this->_backend->delete_page($pagename); @@ -2284,7 +2310,9 @@ public function purge_page($pagename) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return false; } $result = $this->_backend->purge_page($pagename); @@ -2343,7 +2371,9 @@ //unset($this->_versiondata_cache[$pagename][$version]); if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $this->_backend->set_versiondata($pagename, $version, $data); @@ -2357,7 +2387,9 @@ public function update_versiondata($pagename, $version, $data) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $this->_backend->update_versiondata($pagename, $version, $data); @@ -2372,7 +2404,9 @@ public function delete_versiondata($pagename, $version) { if (!empty($this->readonly)) { - trigger_error("readonly database", E_USER_WARNING); + if ((int)DEBUG) { + trigger_error("readonly database", E_USER_WARNING); + } return; } $this->_backend->delete_versiondata($pagename, $version); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-23 17:32:03
|
Revision: 10362 http://sourceforge.net/p/phpwiki/code/10362 Author: vargenau Date: 2021-07-23 17:32:02 +0000 (Fri, 23 Jul 2021) Log Message: ----------- function _coerce_to_version: check first if it is an integer Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2021-07-23 17:31:23 UTC (rev 10361) +++ trunk/lib/WikiDB.php 2021-07-23 17:32:02 UTC (rev 10362) @@ -1511,6 +1511,9 @@ */ private function _coerce_to_version($version_or_pagerevision) { + if (is_int($version_or_pagerevision)) { + return $version_or_pagerevision; + } if (method_exists($version_or_pagerevision, "getContent")) $version = $version_or_pagerevision->getVersion(); else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-26 09:15:16
|
Revision: 10364 http://sourceforge.net/p/phpwiki/code/10364 Author: vargenau Date: 2021-07-26 09:15:12 +0000 (Mon, 26 Jul 2021) Log Message: ----------- PHP Doc Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2021-07-26 08:22:17 UTC (rev 10363) +++ trunk/lib/WikiDB.php 2021-07-26 09:15:12 UTC (rev 10364) @@ -190,20 +190,8 @@ */ public function getPage($pagename) { - static $error_displayed = false; $pagename = (string)$pagename; - if ((int)DEBUG) { - if ($pagename === '') { - if ($error_displayed) return false; - $error_displayed = true; - if (function_exists("xdebug_get_function_stack")) - var_dump(xdebug_get_function_stack()); - trigger_error("empty pagename", E_USER_WARNING); - return false; - } - } else { - assert($pagename != ''); - } + assert($pagename != ''); return new WikiDB_Page($this, $pagename); } @@ -463,7 +451,7 @@ * If false the result is faster in natural order. * @param string $limit Optional. Encoded as "$offset,$count". * $offset defaults to 0. - * @return Iterator A generic iterator containing rows of + * @return WikiDB_backend_dumb_WantedPagesIter A generic iterator containing rows of * (duplicate) pagename, wantedfrom. */ public function wantedPages($exclude_from = '', $exclude = '', $sortby = '', $limit = '') @@ -980,7 +968,7 @@ * * @param array $links List of linkto=>pagename, relation=>pagename which this page links to (hash). * - * @return WikiDB_PageRevision Returns the new WikiDB_PageRevision object. If + * @return false|WikiDB_PageRevision Returns the new WikiDB_PageRevision object. If * $version was incorrect, returns false */ public function createRevision($version, &$content, $metadata, $links) @@ -1504,9 +1492,8 @@ } /** - * @param int|object $version_or_pagerevision - * Takes either the version number (and int) or a WikiDB_PageRevision - * object. + * @param int|WikiDB_PageRevision $version_or_pagerevision + * Takes either the version number (an int) or a WikiDB_PageRevision object. * @return integer The version number. */ private function _coerce_to_version($version_or_pagerevision) @@ -1954,7 +1941,7 @@ /** * Get next WikiDB_Page in sequence. * - * @return WikiDB_Page The next WikiDB_Page in the sequence. + * @return false|WikiDB_Page */ public function next() { @@ -2049,8 +2036,9 @@ /** * Get next WikiDB_PageRevision in sequence. * - * @return WikiDB_PageRevision + * @return false|WikiDB_PageRevision * The next WikiDB_PageRevision in the sequence. + * Return false in case of error. */ public function next() { @@ -2325,7 +2313,6 @@ // FIXME: ugly and wrong. may overwrite full cache with partial cache public function cache_data($data) { - ; //if (isset($data['pagedata'])) // $this->_pagedata_cache[$data['pagename']] = $data['pagedata']; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-12 10:45:57
|
Revision: 10501 http://sourceforge.net/p/phpwiki/code/10501 Author: vargenau Date: 2021-08-12 10:45:55 +0000 (Thu, 12 Aug 2021) Log Message: ----------- PHP Doc Modified Paths: -------------- trunk/lib/WikiDB.php Modified: trunk/lib/WikiDB.php =================================================================== --- trunk/lib/WikiDB.php 2021-08-12 10:22:07 UTC (rev 10500) +++ trunk/lib/WikiDB.php 2021-08-12 10:45:55 UTC (rev 10501) @@ -1234,7 +1234,6 @@ * @param bool $include_empty * @param string $sortby * @param string $limit - * @param string $sortby * @param string $exclude * @param bool $want_relations * @return WikiDB_PageIterator A WikiDB_PageIterator containing This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |