Pastoid

The page you are looking at now is at this URL: http://pastoid.com/bmw

This paste was last updated on January 20, 2009 at 7:56 pm.

Pasted Coderaw

	/**
	 * Deletes logentries from the database
	 * @param mixed Log Entries to delete.  An array of or a single ID/LogEntry object
	**/
	public static function delete_these( $entries )
	{
		if ( ! is_array( $entries ) && ! $entries instanceOf EventLog ) {
			$entries = array( $entries );
		}
 
		if ( count( $entries ) == 0 ) {
			return true;
		}
 
		if ( $entries[0] instanceOf LogEntry ) {
			// We were passed an array of comment objects. Use them directly.
			$result = $entries->delete();
		}
		else if ( is_numeric( $entries[0] ) ) {
			// We were passed an array of ID's. Get their objects and delete them.
			$entries = self::get( array( 'id' => $entries ) );
 
			$result = $entries->delete();
		}
		else {
			// We were passed a type we could not understand.
			$result = false;
		}
 
		return $result;
	}
 
	/**
	 * function delete
	 * Deletes all entries in this object
	 */
	public function delete()
	{
		$cnt = 0;
		$result = true;
		foreach ( $this as $e ) {
			$result &= $e->delete();
			$cnt++;
		}
		EventLog::log( _t( 'Deleted %d entries from the Event Log.', array( $cnt ) ) );
		// Clear ourselves.
		$this->exchangeArray( array() );
		return $result;
	}
 
 

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 6
Is this paste spam?
<Hide