Forked from developdaly/get_beanstalk_revision.php
Last active
August 29, 2015 14:08
-
-
Save ellefsen/3ab1a80e125f2f869cf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function looks for the directory that "wp-config.php" resides in | |
* and then looks for a file named ".revision", the content of which is a | |
* single integer set by Beanstalk upon deployment. | |
* | |
* The purpose is to version static resources so that browsers will | |
* re-download any cached, outdated versions with the newer version. | |
* | |
* This will only work in environments that Beanstak deploys to. | |
*/ | |
function get_beanstalk_revision() { | |
if (file_exists(dirname(ABSPATH) . '/wp-config.php')) { | |
$filename = dirname(ABSPATH) . '/.revision'; | |
} else { | |
$filename = ABSPATH . '/.revision'; | |
} | |
if (file_exists($filename)) { | |
$output = file_get_contents($filename); | |
} else { | |
return false; | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment