コード例 #1
0
ファイル: delete.php プロジェクト: dmitriz/Platform
/**
 * Used to close an existing stream. A cron job may delete this stream later.
 *
 * @module Streams
 * @class Streams_stream
 * @method delete
 * @static
 * @param {array} $_REQUEST
 * @param {string} $_REQUEST.publisherId The id of the stream publisher
 * @param {string} $_REQUEST.streamName The name of the stream the user will be invited to
 */
function Streams_stream_delete()
{
    $user = Users::loggedInUser(true);
    $publisherId = Streams::requestedPublisherId(true);
    $streamName = Streams::requestedName(true);
    Streams::$cache['result'] = Streams::close($user->id, $publisherId, $streamName);
    // NOTE: we did not delete the stream. That will have to be done in a cron job like this:
    // // Clean up access
    // $stream->delete();
    // Streams_Access::delete()->where(array(
    // 	'publisherId' => $stream->publisherId,
    // 	'streamName' => $stream->name
    // ))->execute();
    Q_Response::setSlot('result', Streams::$cache['result']);
}
コード例 #2
0
ファイル: Stream.php プロジェクト: dmitriz/Platform
 /**
  * Closes a stream, which prevents anyone from posting messages to it
  * unless they have WRITE_LEVEL >= "close", as well as attempting to remove
  * all relations to other streams. A "cron job" can later go and delete
  * closed streams. The reason you should avoid deleting streams right away
  * is that other subscribers may still want to receive the last messages
  * posted to the stream.
  * @method close
  * @param {string} $asUserId The id of the user who would be closing the stream
  * @param {array} [$options=array()] Can include "skipAccess"
  * @static
  */
 function close($asUserId, $options = array())
 {
     return Streams::close($asUserId, $this->publisherId, $this->name, $options);
 }