function delete in dataobjects now don't break strict syntax
This commit is contained in:
parent
23a6b4595f
commit
2dfa0bfcee
|
@ -51,12 +51,14 @@ class Avatar extends Managed_DataObject
|
|||
}
|
||||
|
||||
// We clean up the file, too
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$filename = $this->filename;
|
||||
if (parent::delete() && file_exists(Avatar::path($filename))) {
|
||||
if (file_exists(Avatar::path($filename))) {
|
||||
@unlink(Avatar::path($filename));
|
||||
}
|
||||
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -115,10 +115,10 @@ class Config extends Managed_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$result = parent::delete();
|
||||
if ($result) {
|
||||
$result = parent::delete($useWhere);
|
||||
if ($result !== false) {
|
||||
Config::_blowSettingsCache();
|
||||
}
|
||||
return $result;
|
||||
|
|
|
@ -54,14 +54,14 @@ class Consumer extends Managed_DataObject
|
|||
* XXX: Should this happen in an OAuthDataStore instead?
|
||||
*
|
||||
*/
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
// XXX: Is there any reason NOT to do this kind of cleanup?
|
||||
|
||||
$this->_deleteTokens();
|
||||
$this->_deleteNonces();
|
||||
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteTokens()
|
||||
|
|
|
@ -78,7 +78,7 @@ class Fave extends Managed_DataObject
|
|||
return $fave;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$profile = Profile::getKV('id', $this->user_id);
|
||||
$notice = Notice::getKV('id', $this->notice_id);
|
||||
|
@ -87,7 +87,7 @@ class Fave extends Managed_DataObject
|
|||
|
||||
if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) {
|
||||
|
||||
$result = parent::delete();
|
||||
$result = parent::delete($useWhere);
|
||||
self::blow('fave:list-ids:notice_id:%d', $this->notice_id);
|
||||
self::blow('popular');
|
||||
|
||||
|
|
|
@ -84,12 +84,12 @@ class File_to_post extends Managed_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$f = File::getKV('id', $this->file_id);
|
||||
if (!empty($f)) {
|
||||
$f->blowCache();
|
||||
}
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -401,10 +401,10 @@ class Memcached_DataObject extends Safe_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$this->decache(); # while we still have the values!
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
static function memcache() {
|
||||
|
|
|
@ -162,7 +162,7 @@ class Notice extends Managed_DataObject
|
|||
$this->_profile = $profile;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
// For auditing purposes, save a record that the notice
|
||||
// was deleted.
|
||||
|
@ -171,11 +171,11 @@ class Notice extends Managed_DataObject
|
|||
// insert fails.
|
||||
$deleted = Deleted_notice::getKV('id', $this->id);
|
||||
|
||||
if (!$deleted) {
|
||||
if (!$deleted instanceof Deleted_notice) {
|
||||
$deleted = Deleted_notice::getKV('uri', $this->uri);
|
||||
}
|
||||
|
||||
if (!$deleted) {
|
||||
if (!$deleted instanceof Deleted_notice) {
|
||||
$deleted = new Deleted_notice();
|
||||
|
||||
$deleted->id = $this->id;
|
||||
|
@ -202,7 +202,7 @@ class Notice extends Managed_DataObject
|
|||
// NOTE: we don't clear queue items
|
||||
}
|
||||
|
||||
$result = parent::delete();
|
||||
$result = parent::delete($useWhere);
|
||||
|
||||
$this->blowOnDelete();
|
||||
return $result;
|
||||
|
|
|
@ -139,14 +139,14 @@ class Oauth_application extends Managed_DataObject
|
|||
}
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$this->_deleteAppUsers();
|
||||
|
||||
$consumer = $this->getConsumer();
|
||||
$consumer->delete();
|
||||
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteAppUsers()
|
||||
|
|
|
@ -869,7 +869,7 @@ class Profile extends Managed_DataObject
|
|||
return parent::update($dataObject);
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$this->_deleteNotices();
|
||||
$this->_deleteSubscriptions();
|
||||
|
@ -891,7 +891,7 @@ class Profile extends Managed_DataObject
|
|||
$inst->delete();
|
||||
}
|
||||
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteNotices()
|
||||
|
|
|
@ -334,7 +334,7 @@ class Profile_list extends Managed_DataObject
|
|||
* @return boolean success
|
||||
*/
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
// force delete one item at a time.
|
||||
if (empty($this->id)) {
|
||||
|
@ -349,7 +349,7 @@ class Profile_list extends Managed_DataObject
|
|||
|
||||
self::blow('profile:lists:%d', $this->tagger);
|
||||
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -322,10 +322,10 @@ class Profile_tag extends Managed_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$result = parent::delete();
|
||||
if ($result) {
|
||||
$result = parent::delete($useWhere);
|
||||
if ($result !== false) {
|
||||
self::blow('profile_list:tagged_count:%d:%s',
|
||||
$this->tagger,
|
||||
$this->tag);
|
||||
|
|
|
@ -127,10 +127,10 @@ class Profile_tag_subscription extends Managed_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$result = parent::delete();
|
||||
if ($result) {
|
||||
$result = parent::delete($useWhere);
|
||||
if ($result !== false) {
|
||||
self::blow('profile_list:subscriber_count:%d',
|
||||
$this->profile_tag_id);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class Safe_DataObject extends DB_DataObject
|
|||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
function __call($method, array $params)
|
||||
function __call($method, $params)
|
||||
{
|
||||
$return = null;
|
||||
// Yes, that's _call with one underscore, which does the
|
||||
|
|
|
@ -183,10 +183,10 @@ class Status_network extends Safe_DataObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$this->decache(); # while we still have the values!
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,11 +125,10 @@ class Status_network_tag extends Safe_DataObject
|
|||
return $ret;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
$ret = parent::delete();
|
||||
$this->decache();
|
||||
return $ret;
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
static function withTag($tag)
|
||||
|
|
|
@ -678,11 +678,11 @@ class User extends Managed_DataObject
|
|||
return $this->getProfile()->hasRight($right);
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
if (empty($this->id)) {
|
||||
common_log(LOG_WARNING, "Ambiguous User->delete(); skipping related tables.");
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -710,7 +710,7 @@ class User extends Managed_DataObject
|
|||
$this->_deleteTags();
|
||||
$this->_deleteBlocks();
|
||||
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
function _deleteTags()
|
||||
|
|
|
@ -727,11 +727,11 @@ class User_group extends Managed_DataObject
|
|||
* are not de-cached in the UI, including the sidebar lists on
|
||||
* GroupsAction
|
||||
*/
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
if (empty($this->id)) {
|
||||
common_log(LOG_WARNING, "Ambiguous User_group->delete(); skipping related tables.");
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -779,7 +779,7 @@ class User_group extends Managed_DataObject
|
|||
// blow the cached ids
|
||||
self::blow('user_group:notice_ids:%d', $this->id);
|
||||
|
||||
return parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
public function update($dataObject=false)
|
||||
|
|
|
@ -100,11 +100,11 @@ class Spam_score extends Managed_DataObject
|
|||
return $score;
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
self::blow('spam_score:notice_ids');
|
||||
self::blow('spam_score:notice_ids;last');
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -399,9 +399,9 @@ class RSVP extends Managed_DataObject
|
|||
$eventTitle);
|
||||
}
|
||||
|
||||
function delete()
|
||||
function delete($useWhere=false)
|
||||
{
|
||||
self::blow('rsvp:for-event:%s', $event->id);
|
||||
parent::delete();
|
||||
return parent::delete($useWhere);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user