Skip to content

Commit

Permalink
v 2.77.0
Browse files Browse the repository at this point in the history
Base File Cache v 0.2.0 :
- Handle file permissions.
  • Loading branch information
Darklg committed May 2, 2024
1 parent 3195250 commit 19196c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
19 changes: 14 additions & 5 deletions inc/WPUBaseFileCache/WPUBaseFileCache.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
namespace wpubasefilecache_0_1_3;
namespace wpubasefilecache_0_2_0;

/*
Class Name: WPU Base File Cache
Description: A class to handle basic file cache
Version: 0.1.3
Version: 0.2.0
Author: Darklg
Author URI: https://darklg.me/
License: MIT License
Expand All @@ -28,8 +28,9 @@ public function get_cache_dir() {
$cache_dir = $root_cache_dir . '/' . $this->cache_dir . '/';
if (!is_dir($cache_dir)) {
mkdir($cache_dir);
file_put_contents($cache_dir . 'index.html', '');
file_put_contents($cache_dir . '.htaccess', 'deny from all');
chmod($cache_dir, 0775);
$this->file_put_contents($cache_dir . 'index.html', '');
$this->file_put_contents($cache_dir . '.htaccess', 'deny from all');
}
return $cache_dir;
}
Expand Down Expand Up @@ -60,9 +61,17 @@ public function get_cache($cache_id, $expiration = 3600) {

public function set_cache($cache_id, $content = '') {
$cached_file = $this->get_cache_dir() . '/' . $cache_id;
file_put_contents($cached_file, serialize($content));
$this->file_put_contents($cached_file, serialize($content));

return true;
}

/**
* Writes content to a file and sets the file permissions.
*/
public function file_put_contents($file, $content) {
file_put_contents($file, $content);
chmod($file, 0664);
}

}
6 changes: 3 additions & 3 deletions wpubaseplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpubaseplugin
Update URI: https://github.com/WordPressUtilities/wpubaseplugin
Description: A framework for a WordPress plugin
Version: 2.76.0
Version: 2.77.0
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpubaseplugin
Expand All @@ -20,7 +20,7 @@

class WPUBasePlugin {

public $version = '2.76.0';
public $version = '2.77.0';

private $utilities_classes = array(
'messages' => array(
Expand Down Expand Up @@ -60,7 +60,7 @@ class WPUBasePlugin {
'name' => 'WPUBaseToolbox'
),
'filecache' => array(
'namespace' => 'wpubasefilecache_0_1_3',
'namespace' => 'wpubasefilecache_0_2_0',
'name' => 'WPUBaseFileCache'
)
);
Expand Down

0 comments on commit 19196c0

Please sign in to comment.