Permalink
Browse files

Updated README and Paymo class

  • Loading branch information...
1 parent 295bfd9 commit d416d7ab8500f13cc22c4f9ed74c8e0e56d29256 @jamesduncombe committed Jan 30, 2012
Showing with 10 additions and 3 deletions.
  1. +9 −1 class-cache.php
  2. +1 −2 class-paymo.php
View
10 class-cache.php
@@ -31,11 +31,15 @@ public function __construct($cache_file, $cache_time) {
*/
public function createCacheDirectory() {
if (!file_exists(dirname($this->cache_file))) {
- if (!mkdir(dirname($this->cache_file))) {
+ if (!@mkdir(dirname($this->cache_file))) {
die('Please create the cache directory: '.dirname($this->cache_file).' and make sure it\'s writeable by this script.');
} else {
return true;
}
+ } elseif (file_exists(dirname($this->cache_file)) && !is_writable(dirname($this->cache_file))) {
+ die('Cannot write to cache directory. Please make it writeable.');
+ } else {
+ return true;
}
}
@@ -68,6 +72,7 @@ public function setCache($new_data) {
}
} else {
die('DEAD');
+ echo 'HERE';
// first create the cache
$this->createCacheDirectory();
// then fill the cache
@@ -80,6 +85,9 @@ public function setCache($new_data) {
* @return bool
*/
public function checkCache() {
+ if (file_exists(dirname($this->cache_file)) || !is_writable(dirname($this->cache_file))) {
+ $this->createCacheDirectory();
+ }
if (file_exists($this->cache_file)) {
$this->mod_time = filemtime($this->cache_file) + $this->cache_time;
if ($this->mod_time > time()) {
View
3 class-paymo.php
@@ -109,8 +109,7 @@ public function callMethod($request_type, $method, $params = array()) {
// if we're not using a cache
} else {
-
- //echo $method;
+
$api_response = $this->makeRESTRequest($request_type, $method, $request_params);
// check format - XML or JSON

0 comments on commit d416d7a

Please sign in to comment.