Permalink
Browse files

[xupdate] add public function `Xupdate_Func::mainfile_to_readonly`

  • Loading branch information...
nao-pon committed Apr 20, 2015
1 parent 7513ab6 commit cdd25c7c83a6af02407ad7d89e79e3e06ab04c5a
Showing with 19 additions and 0 deletions.
  1. +19 −0 xoops_trust_path/modules/xupdate/class/Func.class.php
@@ -497,6 +497,25 @@ public function write_mainfile_protector($do_chmod = false) {
}
return true;
}
public function mainfile_to_readonly() {
$mailfile = XOOPS_ROOT_PATH . '/mainfile.php';
if ($this->mod_config['ftp_method'] === _XUPDATE_FTP_DIRECT) {
$set_perm = 0400;
} else {
if ($main_perm = @ fileperms($mailfile)) {
$main_perm = substr(sprintf('%o', $main_perm), -3);
$set_perm = '';
for($i=0; $i < 3; $i++) {
$set_perm .= strval(intval($main_perm[$i], 8) & 5);
}
$set_perm = intval($set_perm, 8);
} else {
$set_perm = 0404;
}
}
$this->Ftp->localChmod($mailfile, $set_perm);
}
} // end class
} // end if

0 comments on commit cdd25c7

Please sign in to comment.