Skip to content

Commit

Permalink
Merge branch 'master' into imp_6_2
Browse files Browse the repository at this point in the history
Conflicts:
	imp/docs/INSTALL
  • Loading branch information
slusarz committed Nov 6, 2013
2 parents 89c02fe + 5929d59 commit 27009e0
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 49 deletions.
8 changes: 8 additions & 0 deletions framework/ActiveSync/doc/Horde/ActiveSync/TODO
Expand Up @@ -19,3 +19,11 @@ BC BREAKING (i.e., Horde 6).
============================

- Move all non-specific constants to single class.

- Clean up the various foldertype constant messes. I.e., probably store
the Horde_ActiveSync::FOLDER_TYPE_* and Horde_ActiveSync::CLASS_* values
in the saved state instead of having to switch between them in various
places. (Some client commands are sent using the CLASS, some using the
FOLDER_TYPE).


8 changes: 6 additions & 2 deletions framework/ActiveSync/lib/Horde/ActiveSync/SyncCache.php
Expand Up @@ -287,8 +287,12 @@ public function setPingableCollection($id)
*/
public function removePingableCollection($id)
{
if (empty($this->_data['collections'][$id])) {
throw new InvalidArgumentException('Collection does not exist');
if (empty($this->_data['collections'][$id])) {
$this->_logger->warn(sprintf(
'[%s] Collection %s was asked to be removed from PINGABLE but does not exist.',
$this->_procid,
$id));
return;
}
$this->_data['collections'][$id]['pingable'] = false;
$this->_markCollectionsDirty($id);
Expand Down
33 changes: 33 additions & 0 deletions framework/Pack/composer.json
@@ -0,0 +1,33 @@
{
"name": "horde/horde-pack",
"description": "Horde Pack Utility",
"type": "library",
"homepage": "http://pear.horde.org",
"license": "LGPL-2.1",
"authors": [
{
"name": "Michael Slusarz",
"email": "slusarz@horde.org",
"role": "lead"
}
],
"version": "1.0.0",
"time": "2013-11-06",
"repositories": [
{
"type": "pear",
"url": "http://pear.horde.org"
}
],
"require": {
"php": ">=5.3.0",
"pear-pear.horde.org/Horde_Compress_Fast": ">=1.0.0@stable,<=2.0.0alpha1@stable",
"pear-pear.horde.org/Horde_Exception": ">=2.0.0@stable,<=3.0.0alpha1@stable"
},
"suggest": {
"pear-pear.horde.org/Horde_Test": ">=2.0.0@stable,<=3.0.0alpha1@stable",
"pear-pecl.php.net/igbinary": "*",
"pear-pecl.php.net/msgpack": "*",
"ext-json": "*"
}
}
28 changes: 12 additions & 16 deletions framework/Pack/lib/Horde/Pack.php
Expand Up @@ -24,7 +24,7 @@
class Horde_Pack
{
/* Default compress length (in bytes). */
const DEFAULT_COMPRESS = 256;
const DEFAULT_COMPRESS = 128;

/* Mask for compressed data. */
const COMPRESS_MASK = 64;
Expand Down Expand Up @@ -63,9 +63,18 @@ public function __construct()
}

krsort(self::$_drivers, SORT_NUMERIC);

self::$_compress = new Horde_Compress_Fast();
}
}

/**
*/
public function __sleep()
{
throw new LogicException('Object can not be serialized.');
}

/**
* Pack a string.
*
Expand Down Expand Up @@ -130,7 +139,7 @@ public function pack($data, array $opts = array())
}

if ($compress) {
$packed = $this->_compressOb()->compress($packed);
$packed = self::$_compress->compress($packed);
$key |= self::COMPRESS_MASK;
}
}
Expand All @@ -157,7 +166,7 @@ public function unpack($data)
$data = substr($data, 1);

if ($mask & self::COMPRESS_MASK) {
$data = $this->_compressOb()->decompress($data);
$data = self::$_compress->decompress($data);
$mask ^= self::COMPRESS_MASK;
}

Expand All @@ -169,17 +178,4 @@ public function unpack($data)
throw new Horde_Pack_Exception('Could not unpack data.');
}

/* Internal methods. */

/**
*/
protected function _compressOb()
{
if (!isset(self::$_compress)) {
self::$_compress = new Horde_Compress_Fast();
}

return self::$_compress;
}

}
2 changes: 1 addition & 1 deletion framework/Pack/lib/Horde/Pack/Driver/Serialize.php
Expand Up @@ -42,7 +42,7 @@ public function pack($data)
public function unpack($data)
{
$out = @unserialize($data);
if (($out !== false) || ($out == serialize(false))) {
if (($out !== false) || ($data == serialize(false))) {
return $out;
}

Expand Down
42 changes: 36 additions & 6 deletions framework/Pack/package.xml
Expand Up @@ -10,9 +10,9 @@
<email>slusarz@horde.org</email>
<active>yes</active>
</lead>
<date>2013-11-01</date>
<date>2013-11-06</date>
<version>
<release>1.0.0beta1</release>
<release>1.0.1</release>
<api>1.0.0</api>
</version>
<stability>
Expand All @@ -21,7 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Initial release.
*
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand All @@ -30,7 +30,7 @@
<dir name="Pack">
<file name="COPYING" role="doc" />
</dir> <!-- /doc/Horde/Pack -->
</dir> <!-- /doc/Horde -->
</dir> <!-- /doc/Horde -->
</dir> <!-- /doc -->
<dir name="lib">
<dir name="Horde">
Expand Down Expand Up @@ -63,9 +63,10 @@
<file name="AllTests.php" role="test" />
<file name="AutodetermineTest.php" role="test" />
<file name="bootstrap.php" role="test" />
<file name="PackTest.php" role="test" />
<file name="phpunit.xml" role="test" />
</dir> <!-- /test/Horde/Pack -->
</dir> <!-- /test/Horde -->
</dir> <!-- /test/Horde -->
</dir> <!-- /test -->
</dir> <!-- / -->
</contents>
Expand Down Expand Up @@ -130,15 +131,44 @@
<install as="Horde/Pack/AllTests.php" name="test/Horde/Pack/AllTests.php" />
<install as="Horde/Pack/AutodetermineTest.php" name="test/Horde/Pack/AutodetermineTest.php" />
<install as="Horde/Pack/bootstrap.php" name="test/Horde/Pack/bootstrap.php" />
<install as="Horde/Pack/PackTest.php" name="test/Horde/Pack/PackTest.php" />
<install as="Horde/Pack/phpunit.xml" name="test/Horde/Pack/phpunit.xml" />
<install as="Horde/Pack/Driver/IgbinaryTest.php" name="test/Horde/Pack/Driver/IgbinaryTest.php" />
<install as="Horde/Pack/Driver/JsonTest.php" name="test/Horde/Pack/Driver/JsonTest.php" />
<install as="Horde/Pack/Driver/MsgpackserializeTest.php" name="test/Horde/Pack/Driver/MsgpackserializeTest.php" />
<install as="Horde/Pack/Driver/MsgpackTest.php" name="test/Horde/Pack/Driver/MsgpackTest.php" />
<install as="Horde/Pack/Driver/SerializeTest.php" name="test/Horde/Pack/Driver/SerializeTest.php" />
<install as="Horde/Pack/Driver/TestBase.php" name="test/Horde/Pack/Driver/TestBase.php" />
</filelist>
</filelist>
</phprelease>
<changelog>
<release>
<date>2013-11-06</date>
<version>
<release>1.0.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Initial release.
</notes>
</release>
<release>
<version>
<release>1.0.1</release>
<api>1.0.0</api></version>
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2013-11-05</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
</notes>
</release>
</changelog>
</package>
2 changes: 1 addition & 1 deletion framework/Pack/test/Horde/Pack/AutodetermineTest.php
Expand Up @@ -43,7 +43,7 @@ public function setUp()
public function testNegativeResults()
{
foreach ($this->types as $val) {
$this->_runTest(1, false);
$this->_runTest($val, false);
}

$this->_runTest($this->types, false);
Expand Down
25 changes: 22 additions & 3 deletions framework/Pack/test/Horde/Pack/Driver/TestBase.php
Expand Up @@ -26,12 +26,14 @@
abstract class Horde_Pack_Driver_TestBase extends Horde_Test_Case
{
static protected $pack;
static protected $sampleob;

protected $drivername;

static public function setUpBeforeClass()
{
self::$pack = new Horde_Pack();
self::$sampleob = new Horde_Pack_Autodetermine(true);
}

protected function setUp()
Expand All @@ -56,11 +58,13 @@ public function testNullWithCompression()
public function testBoolean()
{
$this->_runTest(true);
$this->_runTest(false);
}

public function testBooleanWithCompression()
{
$this->_runTest(true, true);
$this->_runTest(false, true);
}

public function testString()
Expand All @@ -75,12 +79,14 @@ public function testStringWithCompression()

public function testSimpleArray()
{
$this->_runTest(array());
$this->_runTest(range(1, 1000));
}

public function testSimpleArrayWithCompression()
{
$this->_runTest(range(1, 1000));
$this->_runTest(array(), true);
$this->_runTest(range(1, 1000), true);
}

public function testNestedArray()
Expand Down Expand Up @@ -108,14 +114,27 @@ public function testObject()
$ob->foo2 = array(1, 2, 3);
$ob->foo3 = 4;
$ob->foo4 = true;
$ob->foo5 = null;
$this->_runTest($ob);
}

public function testObjectWithCompression()
{
$ob = new stdClass;
$ob->foo = 'bar';
$ob->foo2 = array(1, 2, 3);
$ob->foo3 = 4;
$ob->foo4 = true;
$ob->foo5 = null;
$this->_runTest($ob);
}

public function testPhpObject()
{
/* Not all backends support. */
$driver = new $this->drivername();
if ($driver->phpob) {
$this->_runTest(self::$pack);
$this->_runTest(self::$sampleob);
}
}

Expand All @@ -124,7 +143,7 @@ public function testPhpObjectWithCompression()
/* Not all backends support. */
$driver = new $this->drivername();
if ($driver->phpob) {
$this->_runTest(self::$pack, true);
$this->_runTest(self::$sampleob, true);
}
}

Expand Down
37 changes: 37 additions & 0 deletions framework/Pack/test/Horde/Pack/PackTest.php
@@ -0,0 +1,37 @@
<?php
/**
* Copyright 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 Horde
* @copyright 2013 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Pack
* @subpackage UnitTests
*/

/**
* Test for the base Horde_Pack object.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013 Horde LLC
* @ignore
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Pack
* @subpackage UnitTests
*/
class Horde_Pack_PackTest extends Horde_Test_Case
{
/**
* @expectedException LogicException
*/
public function testExpectedExceptionOnSerialize()
{
$pack = new Horde_Pack();
serialize($pack);
}

}
4 changes: 0 additions & 4 deletions hermes/lib/Api.php
Expand Up @@ -496,10 +496,6 @@ public function listTimeObjectCategories()
*/
public function listTimeObjects($time_categories, $start, $end)
{
$slices = $GLOBALS['injector']
->getInstance('Hermes_Driver')
->getHours($params);

$objects = array();

foreach ($time_categories as $category) {
Expand Down
13 changes: 4 additions & 9 deletions horde/lib/Test.php
Expand Up @@ -700,15 +700,10 @@ protected function _checkGcProbability()
*/
public function requiredFileCheck()
{
$output = '';

$php = trim(system('which php'));
if (!$php || !file_exists($php)) {
$output = '<p style="color:orange">Cannot find PHP command-line binary on your system. Syntax checking of configuration files is disabled.</p>';
$php = null;
} else {
$output = '';
}
$php = System::which('php', null);
$output = is_null($php)
? '<p style="color:orange">Cannot find PHP command-line binary on your system. Syntax checking of configuration files is disabled.</p>'
: '';

ksort($this->_fileList);

Expand Down
1 change: 0 additions & 1 deletion imp/js/dimpbase.js
Expand Up @@ -2401,7 +2401,6 @@ var DimpBase = {
if (!d.opera && !d.wasDragged) {
$('folderopts_link').up().hide();
$('dropbase').up().show();
d.ghost.removeClassName('on');
}
}
},
Expand Down

0 comments on commit 27009e0

Please sign in to comment.