summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-08-04 15:53:15 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-08-04 15:53:15 +0000
commitd0a020dd4ea8d58bc8230ebcde22e54ad31894a8 (patch)
treec7d14f1e09bd46c72e577ca54645a7bab4a747e7 /classes
parent5f3af3e121a7ff06f5961bb4158e0b777ce5b5c1 (diff)
parentffa1d662a759a729151f2444bdf759749d59045e (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'classes')
-rw-r--r--classes/File.php5
-rw-r--r--classes/Session.php17
2 files changed, 18 insertions, 4 deletions
diff --git a/classes/File.php b/classes/File.php
index 0c4fbf7e6..959301eda 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -93,7 +93,6 @@ class File extends Memcached_DataObject
if (empty($file)) {
$file_redir = File_redirection::staticGet('url', $given_url);
if (empty($file_redir)) {
- common_debug("processNew() '$given_url' not a known redirect.\n");
$redir_data = File_redirection::where($given_url);
$redir_url = $redir_data['url'];
if ($redir_url === $given_url) {
@@ -114,7 +113,9 @@ class File extends Memcached_DataObject
if (empty($x)) {
$x = File::staticGet($file_id);
- if (empty($x)) die('Impossible!');
+ if (empty($x)) {
+ throw new ServerException("Robin thinks something is impossible.");
+ }
}
File_to_post::processNew($file_id, $notice_id);
diff --git a/classes/Session.php b/classes/Session.php
index ac80279c5..5ec509f5f 100644
--- a/classes/Session.php
+++ b/classes/Session.php
@@ -108,11 +108,24 @@ class Session extends Memcached_DataObject
$epoch = common_sql_date(time() - $maxlifetime);
+ $ids = array();
+
$session = new Session();
$session->whereAdd('modified < "'.$epoch.'"');
- $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY);
+ $session->selectAdd();
+ $session->selectAdd('id');
+
+ $session->find();
+
+ while ($session->fetch()) {
+ $ids[] = $session->id;
+ }
+
+ $session->free();
- self::logdeb("garbage collection result = $result");
+ foreach ($ids as $id) {
+ self::destroy($id);
+ }
}
static function setSaveHandler()