public static function add_versioning($gitPath, $pathFromRoot = '/') { $db = ''; if (is_multisite()) { $db = get_site_option('database_version'); } else { $db = get_option('database_version'); } if (!strlen($db)) { Jigsaw::show_notice('Database version not found'); } add_filter('update_footer', function ($default) use($gitPath, $pathFromRoot, $db) { // SQL row with the meta_key of "database_version," located in the "sitemeta" sql table // Edit that row every time you export a database for handoff $gitPath = trailingslashit($gitPath) . 'commit/'; $gitMeta = ''; exec('cd ' . ABSPATH . $pathFromRoot . '; git rev-parse --verify HEAD 2> /dev/null', $output); $hash = substr($output[0], 0, 6); // $gitMeta = if(isset($meta)) {'by ' . $meta . ', '}; // exec('cd ' . $_SERVER["DOCUMENT_ROOT"] . '/wp-content/themes; git log -1 --pretty=format:"%an, %ar"', $meta); $db = apply_filters('jigsaw_versioning_database', $db); $commit = ', <strong>Code Commit:</strong> ' . '<a href="' . $gitPath . $output[0] . '">' . $hash . '</a>, ' . $gitMeta; $return = '<strong>Database:</strong> ' . $db . $commit . $default; return $return; }, 11); }
<?php /** * @wordpress-plugin * Plugin Name: Agreable Instant Articles Plugin * Description: A WordPress plugin to generate Instant Articles Format content. * Version: 1.0.0 * Author: Shortlist Media * Author URI: http://shortlistmedia.co.uk/ * License: MIT */ if (file_exists(__DIR__ . '/vendor/autoload.php')) { require_once __DIR__ . '/vendor/autoload.php'; } else { require_once __DIR__ . '/../../../../vendor/autoload.php'; } if (file_exists(__DIR__ . '/vendor/getherbert/framework/bootstrap/autoload.php')) { require_once __DIR__ . '/vendor/getherbert/framework/bootstrap/autoload.php'; } else { require_once __DIR__ . '/../../../../vendor/getherbert/framework/bootstrap/autoload.php'; } if (!getenv('FB_INSTANT_ARTICLES_DEVELOPMENT_MODE')) { \Jigsaw::show_notice("<b>NOTICE</b>: FB_INSTANT_ARTICLES_DEVELOPMENT_MODE missing from .env", 'error'); }