From f7336ce9e4ba577674c70cf09d818c0ff15b1e12 Mon Sep 17 00:00:00 2001 From: Jeffrey Gunderson Date: Sat, 15 Aug 2015 13:56:32 -0600 Subject: [PATCH 1/2] Checks added to ensure the required php functions are loaded --- lib/php/Library.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/php/Library.php b/lib/php/Library.php index 18ce4a3..93a675e 100644 --- a/lib/php/Library.php +++ b/lib/php/Library.php @@ -54,6 +54,14 @@ public function __construct($libraryType = null, $libraryID = null, $libraryUrlI if (!extension_loaded('curl')) { throw new Exception("You need cURL"); } + //check if APC is loaded + if (!extension_loaded('apc') && !ini_get('apc.enabled')) { + throw new Exception("PHP extension APC is not loaded/or enabled in php.ini"); + } + //check if DOMDocument object is loaded + if (!extension_loaded('xml')) { + throw new Exception("PHP extension XML is not loaded"); + } $this->libraryType = $libraryType; $this->libraryID = $libraryID; From 765106ec10ea99680b9ab847271bf84b1b5386d7 Mon Sep 17 00:00:00 2001 From: Jeffrey Gunderson Date: Sat, 15 Aug 2015 14:21:25 -0600 Subject: [PATCH 2/2] Created setter for protected variable in Library; use setter in Collections --- lib/php/Collections.php | 2 +- lib/php/Library.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/php/Collections.php b/lib/php/Collections.php index f98ebb8..3ec608d 100644 --- a/lib/php/Collections.php +++ b/lib/php/Collections.php @@ -193,7 +193,7 @@ public function fetchCollections($params = array()){ } $feed = new Zotero_Feed($response->getRawBody()); - $this->owningLibrary->_lastFeed = $feed; + $this->owningLibrary->setLastFeed($feed); $addedCollections = $this->addCollectionsFromFeed($feed); if(isset($feed->links['next'])){ diff --git a/lib/php/Library.php b/lib/php/Library.php index 93a675e..3013a5c 100644 --- a/lib/php/Library.php +++ b/lib/php/Library.php @@ -279,6 +279,16 @@ public function getLastFeed(){ return $this->_lastFeed; } + /** + * Sets the last Zotero_Feed + * + * @param Zotero_feed + */ + public function setLastFeed($feed) + { + $this->_lastFeed = $feed; + } + /** * Construct a string that uniquely identifies a library * This is not related to the server GUIDs