-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset-file-permissions-magento.php
More file actions
48 lines (37 loc) · 1.29 KB
/
reset-file-permissions-magento.php
File metadata and controls
48 lines (37 loc) · 1.29 KB
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
<?php
/**
* Reseting file and folder permissions for magento
*
* @version 1.0.0
* @author Nikola Papratović <nikola.papratovic@gmail.com>
* @copyright Copyright (c) 2016 Nikola Papratović
* @link nikolapapratovic.iz.hr
*
* Instructions: place the following script inside the root direcotory of your magento and open in browser:
*
* http://yourwebsite.com/reset-file-permissions.php
*
*/
$start_dir = '/'; // Starting directory name no trailing slashes.
$perms['file'] = 0644; // chmod value for files don't enclose value in quotes.
$perms['folder'] = 0755; // chmod value for folders don't enclose value in quotes.
function chmod_file_folder($dir) {
global $perms;
$dh=@opendir($dir);
if ($dh) {
while (false !==($file = readdir($dh))) {
if($file != "." && $file != "..") {
$fullpath = $dir .'/'. $file;
if(!is_dir($fullpath)) {
chmod($fullpath, $perms['file']);
}else {
chmod($fullpath, $perms['folder']);
chmod_file_folder($fullpath);
}
}
}
closedir($dh);
}
}
chmod_file_folder($start_dir);
?>