Skip to content

Commit

Permalink
Adding TODOs, reordering methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Dec 30, 2015
1 parent fa7bbfc commit f887948
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions src/includes/closures/Plugin/HtaccessUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* @since 15xxxx Improving `.htaccess` tweaks.
*
* @return array Plugin options that have associated htaccess rules
*
* @note We keep track of this to avoid the issue described here: http://git.io/vEFIH
*/
$self->options_with_htaccess_rules = array('cdn_enable');

Expand All @@ -25,6 +27,8 @@
* @since 151114 Adding `.htaccess` tweaks.
*
* @return boolean True if added successfully.
*
* @TODO Improve error reporting detail to better catch unexpected failures; see http://git.io/vEFLT
*/
$self->addWpHtaccess = function () use ($self) {
global $is_apache;
Expand Down Expand Up @@ -86,6 +90,8 @@
* @since 151114 Adding `.htaccess` tweaks.
*
* @return boolean True if removed successfully.
*
* @TODO Improve error reporting detail to better catch unexpected failures; see http://git.io/vEFLT
*/
$self->removeWpHtaccess = function () use ($self) {
global $is_apache;
Expand Down Expand Up @@ -150,25 +156,6 @@
return false; // No, there are no options enabled that require htaccess rules.
};

/*
* Utility method used to unlock and close htaccess file resource.
*
* @since 151114 Adding `.htaccess` tweaks.
*
* @param array $htaccess Array containing at least an `fp` file resource pointing to htaccess file.
*
* @return bool False on failure, true otherwise.
*/
$self->closeHtaccessFile = function (array $htaccess) use ($self) {
if (!is_resource($htaccess['fp'])) {
return false; // Failure; requires a valid file resource.
}
flock($htaccess['fp'], LOCK_UN);
fclose($htaccess['fp']);

return true;
};

/*
* Utility method used to check if htaccess file contains $htaccess_marker
*
Expand Down Expand Up @@ -271,3 +258,22 @@

return true;
};

/*
* Utility method used to unlock and close htaccess file resource.
*
* @since 151114 Adding `.htaccess` tweaks.
*
* @param array $htaccess Array containing at least an `fp` file resource pointing to htaccess file.
*
* @return bool False on failure, true otherwise.
*/
$self->closeHtaccessFile = function (array $htaccess) use ($self) {
if (!is_resource($htaccess['fp'])) {
return false; // Failure; requires a valid file resource.
}
flock($htaccess['fp'], LOCK_UN);
fclose($htaccess['fp']);

return true;
};

0 comments on commit f887948

Please sign in to comment.