Commit Graph

134 Commits

Author SHA1 Message Date
Mikael Nordfeldth
79e3acf0f0 Moved multiGet into Managed_DataObject 2013-08-29 10:38:11 +02:00
Mikael Nordfeldth
b3e61ce7d0 Stronger typing, require array where param array 2013-08-29 10:27:39 +02:00
Mikael Nordfeldth
fac7371179 pivotGet moved into Managed_DataObject 2013-08-29 10:13:07 +02:00
Mikael Nordfeldth
0785cc2469 Don't use DB_DataObject::factory (statically at least)
Not all instances of this has been fixed, but at least the ones
in the base class of Memcached_DataObject.

Avatar fix (in classes/Profile.php) requires a pkeyGet function
in the Avatar class (or as in this tree, the parent class of
Managed_DataObject)
2013-08-19 11:40:35 +02:00
Mikael Nordfeldth
97ce71e55d Managed_DataObject now has listGet for all classes 2013-08-18 21:02:33 +02:00
Mikael Nordfeldth
3ce5631b3c Memcached_DataObject::multicache is now properly defined static 2013-08-18 16:21:30 +02:00
Mikael Nordfeldth
861e838add pkeyGet is now static and more similar to getKV
Memcached_DataObject now defines
   * pkeyGetClass to avoid collision with Managed_DataObject pkeyGet
   * getClassKV to avoid collision with Managed_DataObject getKV
2013-08-18 15:42:51 +02:00
Mikael Nordfeldth
2a4dc77a63 The overloaded DB_DataObject function staticGet is now called getKV
I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV

   sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq)

If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV!

This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class)

Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
2013-08-18 13:13:56 +02:00
Mikael Nordfeldth
3394efca60 staticGet is a static function
We always call staticGet statically, so we define it statically. Next
step is to remove a bunch of definitions of 'staticGet' from classes
that can instead fall back to a parent class in Managed_DataObject.

The ampersand is removed as we're returning a class anyway, which does
not need a reference (and when we return false, it means nothing).
2013-08-12 19:08:11 +02:00
Siebrand Mazeland
23eb49a017 Update translator documentation and i18n. 2011-08-30 11:43:27 +02:00
Siebrand Mazeland
5a37d0bdc6 Add translator documentation. 2011-08-30 11:04:54 +02:00
Siebrand Mazeland
c4fd560b32 Fix i18n issues
Remove trailing whitespace and convert leading tabs to spaces
2011-08-30 11:03:26 +02:00
Evan Prodromou
968cef0fc6 strtolower() the class name in cache keys for listGet() 2011-08-24 17:30:17 -04:00
Evan Prodromou
ce5b44158e Get primary key for default value in Memcached_DataObject::staticGet() 2011-08-23 00:14:20 -04:00
Evan Prodromou
0a17e7cf9f Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x
Conflicts:
	classes/Memcached_DataObject.php
2011-08-22 11:25:13 -04:00
Siebrand Mazeland
73806460ce Add translator documentation.
Fix incorrect i18n.
Whitespace updates.
2011-08-19 17:38:43 +02:00
Evan Prodromou
f405ffa507 Corrected pkeys for listGet() 2011-08-08 12:01:15 -04:00
Evan Prodromou
ed31052d26 Store pkeys in cache for listGet()
I was storing the full objects in the cache for the listGet()
function. I've changed it to store only pkeys, and use pivotGet() to
get all the corresponding values.

This also required changing pivotGet() so it can get objects with
multi-column pkeys, which complicated the whole thing quite a bit. But
it seems to work OK.
2011-08-08 10:22:20 -04:00
Evan Prodromou
447ae92eca only do a db call if need to fetch some in listGet() 2011-08-02 18:12:46 -04:00
Evan Prodromou
435c08a753 add listGet() method 2011-08-02 17:20:51 -04:00
Evan Prodromou
e05f423bea properly cache nulls for pivotGet() 2011-08-02 11:54:10 -04:00
Evan Prodromou
9a78d70441 remove debugging statement in Memcached_DataObject::multiGet() 2011-08-02 10:58:25 -04:00
Evan Prodromou
72ed297214 New method Memcached_DataObject::pivotGet()
This method lets you get all the objects with a given variable key and
another set of "fixed" keys. A good example is getting all the avatars
for a notice list; the avatar size stays the same, but the IDs change.

Since it's very similar to multiGet(), I refactored that function to
use pivotGet().

And, yes, I realize these are kind of hard to follow.
2011-08-02 10:46:29 -04:00
Evan Prodromou
ae340ec345 explicitly skip nulls in Memcached_DataObject::multiGet() 2011-07-14 14:41:30 -04:00
Evan Prodromou
75b280b4bb add Memcached_DataObject::multiGet() method 2011-07-14 12:02:44 -04:00
Evan Prodromou
5c963cb3b7 Memcached_DataObject::pkeyGet() accepts null values 2011-07-11 12:40:28 -04:00
Evan Prodromou
4331b8b4f1 make search results privacy-aware 2011-04-11 18:59:58 -04:00
Evan Prodromou
83fb5e6023 Mass replacement of #-comments with //-comments
like leprous boils in our code. So, I've replaced all of them with //
comments instead. It's a massive, meaningless, and potentially buggy
change -- great one for the middle of a release cycle, eh?
2011-03-22 11:54:23 -04:00
Zach Copley
b7d0746694 Merge branch '0.9.x' into 1.0.x
Conflicts:
	actions/confirmaddress.php
	actions/emailsettings.php
	actions/hostmeta.php
	actions/imsettings.php
	actions/login.php
	actions/profilesettings.php
	actions/showgroup.php
	actions/smssettings.php
	actions/urlsettings.php
	actions/userauthorization.php
	actions/userdesignsettings.php
	classes/Memcached_DataObject.php
	index.php
	lib/accountsettingsaction.php
	lib/action.php
	lib/common.php
	lib/connectsettingsaction.php
	lib/designsettings.php
	lib/personalgroupnav.php
	lib/profileaction.php
	lib/userprofile.php
	plugins/ClientSideShorten/ClientSideShortenPlugin.php
	plugins/Facebook/FBConnectSettings.php
	plugins/Facebook/FacebookPlugin.php
	plugins/NewMenu/NewMenuPlugin.php
	plugins/NewMenu/newmenu.css
2011-02-28 15:39:43 -08:00
Brion Vibber
de7726dd00 Performance counters: records number of total and unique cache get/set/incr/deletes and queries, and logs to syslog.
$config['site']['logperf'] = true; // to record & dump total hits of each type and the runtime to syslog
$config['site']['logperf_detail'] = true; // very verbose -- dump the individual cache keys and queries as they get used (may contain private info in some queries)

Seeing 180 cache gets on a timeline page seems not unusual currently; since these run in serial, even relatively small roundtrip times can add up heavily.
We should consider ways to reduce the number of round trips, such as more frequently storing compound objects or the output of processing in memcached.
Doing parallel multi-key lookups could also help by collapsing round-trip times, but might not be easy to fit into SN's object model. (For things like streams this should actually work pretty well -- grab the list, then when it's returned go grab all the individual items in parallel and return the list)
2011-01-31 13:12:56 -08:00
Brion Vibber
54f7154db8 Fix for ticket #3020: set MySQL session time_zone variable to UTC ('+0:00') so TIMESTAMP column values are comparable against our other UTC timestamp values.
MySQL stores TIMESTAMP columns as UTC, but with a local time interface. (SRSLY?!) DATETIME columns are always bare and assumed to be local time, but we keep only UTC in them.
Forcing the session time_zone to UTC means we won't have to worry as much about what we're sending/receiving in there.

Also will let us remove the hack in master commit a7abb2323e for session tweaks
2011-01-31 11:45:19 -08:00
Evan Prodromou
32eb4c5e2d Merge remote branch 'gitorious/0.9.x' into 1.0.x
Conflicts:
	lib/common.php
2010-12-30 15:52:08 -08:00
Evan Prodromou
763a5f182d Memcache_DataObject checks for PEAR::isError() on results 2010-12-26 21:08:20 -08:00
Brion Vibber
d8a3a88ec8 Merge branch '0.9.x' into 1.0.x
Conflicts:
	classes/Memcached_DataObject.php
2010-12-17 17:13:21 -08:00
Brion Vibber
0535a3d15c Event hook for SQLProfile 2010-12-17 11:46:11 -08:00
Brion Vibber
a7d98435f6 Tweak DB query logging to also log queries that fail; the exceptions we get are often not very descriptive like "No such table" without saying which table. :) 2010-10-15 11:26:06 -07:00
Brion Vibber
59119482ca Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Conflicts:
	actions/hostmeta.php
	actions/imsettings.php
	classes/User.php
	lib/adminpanelaction.php
	lib/channel.php
	lib/default.php
	lib/router.php
	lib/util.php
2010-10-04 12:54:36 -07:00
Siebrand Mazeland
b03ece26eb * i18n/L10n and translator documentation updates.
* whitespace and indentation updates
2010-09-28 23:21:09 +02:00
Evan Prodromou
a319b40c97 common_cache_key() -> Cache::key() 2010-09-06 10:07:43 -04:00
Evan Prodromou
e42d2124a3 common_keyize() -> Cache::keyize() 2010-09-06 10:03:51 -04:00
Evan Prodromou
8f81762d68 common_memcache() => Cache::instance() 2010-09-06 09:56:45 -04:00
Brion Vibber
7e55fc0044 OStatus/FeedSub: tweaked PuSH feed garbage collection so other plugins can declare usage of a low-level feed or an OStatus profile besides profile subscriptions & group memberships.
SubMirror: redid add-mirror frontend to accept a feed URL, then pass that on to OStatus, instead of pulling from your subscriptions.
Profile: tweaked subscriberCount() so it doesn't subtract 1 for foreign profiles who aren't subscribed to themselves; instead excludes the self-subscription in the count query.
Memcached_DataObject: tweak to avoid extra error spew in the DB error raising

Work in progress: tweaking feedsub garbage collection so we can count other uses
2010-08-06 11:49:52 -07:00
Evan Prodromou
9f0715a993 Merge branch '0.9.x' into 1.0.x 2010-08-03 16:05:03 -07:00
Siebrand Mazeland
e753422480 * Address i18n related FIXMEs after talk with Brion.
* Tweak message
2010-07-30 19:15:07 +02:00
Siebrand Mazeland
e7acb45b57 * add string for translation with translator documentation
* add FIXMEs for strings that may need i18n, but leaving decision to other dev(s)
2010-07-29 12:58:48 +02:00
Evan Prodromou
d73feb82d8 cache sitemap notice and user counts for 4h 2010-07-14 10:38:34 -04:00
Brion Vibber
004200f958 Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x 2010-06-11 12:09:55 -07:00
Evan Prodromou
6d39a75137 use DB_DataObject_Cast objects in a couple of different places in the code 2010-06-04 15:29:38 -04:00
Evan Prodromou
f1ea678aae memcache_dataobject supports some DB_DataObject_Cast objects as values 2010-06-04 12:52:05 -04:00
Evan Prodromou
727ea5a516 Merge branch '0.9.x' into 1.0.x 2010-04-07 10:47:29 -04:00