Created
November 28, 2012 03:25
-
-
Save developdaly/4158855 to your computer and use it in GitHub Desktop.
This function gets the latest Beanstalk SVN/Git revision number for use in your theme/plugin
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