/usr/share/php/Horde/Kolab/Storage/Folder/Stamp/Uids.php is in php-horde-kolab-storage 2.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | <?php
/**
* A folder stamp that includes a list of UIDs.
*
* PHP version 5
*
* @category Kolab
* @package Kolab_Storage
* @author Thomas Jarosch <thomas.jarosch@intra2net.com>
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
/**
* A folder stamp that includes a list of UIDs.
*
* Copyright 2011-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Kolab
* @package Kolab_Storage
* @author Thomas Jarosch <thomas.jarosch@intra2net.com>
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
class Horde_Kolab_Storage_Folder_Stamp_Uids
implements Horde_Kolab_Storage_Folder_Stamp
{
/** The UID validity status */
const UIDVALIDITY = 'uidvalidity';
/** The next UID status */
const UIDNEXT = 'uidnext';
/**
* The folder status.
*
* @var array
*/
private $_status;
/**
* The list of backend object IDs.
*
* @var array
*/
private $_ids;
/**
* Constructor.
*
* @param array $status The folder status.
* @param array $ids The list of undeleted objects in the folder.
*/
public function __construct($status, $ids)
{
$this->_status = $status;
$this->_ids = $ids;
}
/**
* Return the folder UID validity.
*
* @return string The folder UID validity marker.
*/
public function uidvalidity()
{
return $this->_status[self::UIDVALIDITY];
}
/**
* Return the folder next UID number.
*
* @return string The next UID number.
*/
public function uidnext()
{
return $this->_status[self::UIDNEXT];
}
/**
* Return the backend object IDs in the folder.
*
* @return array The list of backend IDs.
*/
public function ids()
{
return $this->_ids;
}
/**
* Indicate if there was a complete folder reset.
*
* @param Horde_Kolab_Storage_Folder_Stamp_Uids The stamp to compare against.
*
* @return boolean True if there was a complete folder reset stamps are
* different, false if not.
*/
public function isReset(Horde_Kolab_Storage_Folder_Stamp $stamp)
{
if (!$stamp instanceOf Horde_Kolab_Storage_Folder_Stamp_Uids) {
throw new Horde_Kolab_Storage_Exception('This stamp can only be compared against stamps of its own type.');
}
if ($this->uidvalidity() != $stamp->uidvalidity()) {
return true;
} else {
return false;
}
}
/**
* What changed between this old stamp and the new provided stamp?
*
* @param Horde_Kolab_Storage_Folder_Stamp_Uids The new stamp to compare against.
*
* @return array|boolean False if there was no change, an array of two
* elements (added IDs, deleted IDs) otherwise.
*/
public function getChanges(Horde_Kolab_Storage_Folder_Stamp $stamp)
{
if (!$stamp instanceOf Horde_Kolab_Storage_Folder_Stamp_Uids) {
throw new Horde_Kolab_Storage_Exception('This stamp can only be compared against stamps of its own type.');
}
if ($this->uidnext() != $stamp->uidnext()
|| count($this->ids()) != count($stamp->ids())) {
return array(
self::DELETED => array_values(
array_diff($this->ids(), $stamp->ids())
),
self::ADDED => array_values(
array_diff($stamp->ids(), $this->ids())
)
);
}
return false;
}
/**
* Serialize this object.
*
* @return string The serialized data.
*/
public function serialize()
{
return serialize(array($this->_status, $this->_ids));
}
/**
* Reconstruct the object from serialized data.
*
* @param string $data The serialized data.
*/
public function unserialize($data)
{
list($this->_status, $this->_ids) = @unserialize($data);
}
/**
* Convert the instance into a string.
*
* @return string The string representation for this instance.
*/
public function __toString()
{
return sprintf(
"uidvalidity: %s\nuidnext: %s\nuids: %s",
$this->uidvalidity(),
$this->uidnext(),
join(', ', $this->ids())
);
}
}
|