Plugin Directory

Changeset 1719790


Ignore:
Timestamp:
08/26/2017 12:40:00 PM (8 years ago)
Author:
litefeel
Message:

auto deploy from deploy2wp:https://github.com/litefeel/deploy2wp

Location:
writing-on-github/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • writing-on-github/trunk/lib/admin.php

    r1713007 r1719790  
    257257            Writing_On_GitHub::$instance->start_export();
    258258        }
    259 
    260259        if ( 'force_export' === $_GET['action'] ) {
    261260            Writing_On_GitHub::$instance->start_export(true);
    262261        }
    263 
    264262        if ( 'import' === $_GET['action'] ) {
    265263            Writing_On_GitHub::$instance->start_import();
    266264        }
     265        if ( 'force_import' === $_GET['action'] ) {
     266            Writing_On_GitHub::$instance->start_import(true);
     267        }
    267268
    268269        wp_redirect( admin_url( 'options-general.php?page=writing-on-github' ) );
  • writing-on-github/trunk/lib/controller.php

    r1713007 r1719790  
    9191    /**
    9292     * Imports posts from the current master branch.
    93      *
    94      * @return boolean
    95      */
    96     public function import_master( $user_id = 0 ) {
     93     * @param  integer $user_id
     94     * @param  boolean $force
     95     * @return boolean
     96     */
     97    public function import_master( $user_id = 0, $force = false ) {
    9798        if ( ! $this->app->semaphore()->is_open() ) {
    9899            return $this->app->response()->error( new WP_Error(
     
    110111        }
    111112
    112         $result = $this->app->import()->master();
     113        $result = $this->app->import()->master( $force );
    113114
    114115        $this->app->semaphore()->unlock();
  • writing-on-github/trunk/lib/import.php

    r1713007 r1719790  
    5656     * import blob by files
    5757     * @param  Writing_On_GitHub_File_Info[] $files
     58     * @param  boolean $force
    5859     *
    5960     * @return true|WP_Error
    6061     */
    61     protected function import_files( $files ) {
     62    protected function import_files( $files, $force = false ) {
    6263
    6364        $error = true;
     
    8384                    $result = $this->delete_post( $blob );
    8485                } else {
    85                     $result = $this->import_post( $blob );
     86                    $result = $this->import_post( $blob, $force );
    8687                }
    8788            }
     
    99100     * Imports the latest commit on the master branch.
    100101     *
     102     * @param  boolean $force
    101103     * @return string|WP_Error
    102104     */
    103     public function master() {
     105    public function master( $force = false ) {
    104106        $result = $this->app->api()->fetch()->tree_recursive();
    105107
     
    110112
    111113        if ( is_array( $result ) ) {
    112             $result = $this->import_files( $result );
     114            $result = $this->import_files( $result, $force );
    113115        }
    114116
     
    190192     * Imports a post into wordpress
    191193     * @param  Writing_On_GitHub_Blob $blob
     194     * @param  boolean                $force
    192195     * @return WP_Error|bool
    193196     */
    194     protected function import_post( Writing_On_GitHub_Blob $blob ) {
    195         $post = $this->blob_to_post( $blob );
     197    protected function import_post( Writing_On_GitHub_Blob $blob, $force = false ) {
     198        $post = $this->blob_to_post( $blob, $force );
    196199
    197200        if ( ! $post instanceof Writing_On_GitHub_Post ) {
     
    266269     *
    267270     * @param Writing_On_GitHub_Blob $blob Blob to transform into a Post.
     271     * @param boolean                $force
    268272     *
    269273     * @return Writing_On_GitHub_Post|false
    270274     */
    271     protected function blob_to_post( Writing_On_GitHub_Blob $blob ) {
     275    protected function blob_to_post( Writing_On_GitHub_Blob $blob, $force = false ) {
    272276        $args = array( 'post_content' => $blob->content_import() );
    273277        $meta = $blob->meta();
     
    305309        $meta['_wogh_sha'] = $blob->sha();
    306310
    307         if ( $id ) {
     311        if ( ! $force && $id ) {
    308312            $old_sha = get_post_meta( $id, '_wogh_sha', true );
    309313            $old_github_path = get_post_meta( $id, '_wogh_github_path', true );
  • writing-on-github/trunk/readme.txt

    r1713654 r1719790  
    77Requires at least: 3.9 
    88Tested up to: 4.8.1 
    9 Stable tag: 1.6.1 
     9Stable tag: 1.7 
    1010License: GPLv2 
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    135135== Changelog ==
    136136
     137= 1.7 =
     138
     139* Add an option to force import from github
     140
    137141= 1.6.1 =
    138142
     
    193197  [1.6]: https://github.com/litefeel/writing-on-github/releases/tag/1.6
    194198  [1.6.1]: https://github.com/litefeel/writing-on-github/releases/tag/1.6.1
     199  [1.7]: https://github.com/litefeel/writing-on-github/releases/tag/1.7
  • writing-on-github/trunk/vendor/autoload.php

    r1713654 r1719790  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitf09e17fb75429ec5fb15edb97611faf1::getLoader();
     7return ComposerAutoloaderInitdceed942811feb8a045169f778363db6::getLoader();
  • writing-on-github/trunk/vendor/composer/autoload_real.php

    r1713654 r1719790  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitf09e17fb75429ec5fb15edb97611faf1
     5class ComposerAutoloaderInitdceed942811feb8a045169f778363db6
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitf09e17fb75429ec5fb15edb97611faf1', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitdceed942811feb8a045169f778363db6', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitf09e17fb75429ec5fb15edb97611faf1', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitdceed942811feb8a045169f778363db6', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInitf09e17fb75429ec5fb15edb97611faf1::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInitdceed942811feb8a045169f778363db6::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
     
    4949
    5050        if ($useStaticLoader) {
    51             $includeFiles = Composer\Autoload\ComposerStaticInitf09e17fb75429ec5fb15edb97611faf1::$files;
     51            $includeFiles = Composer\Autoload\ComposerStaticInitdceed942811feb8a045169f778363db6::$files;
    5252        } else {
    5353            $includeFiles = require __DIR__ . '/autoload_files.php';
    5454        }
    5555        foreach ($includeFiles as $fileIdentifier => $file) {
    56             composerRequiref09e17fb75429ec5fb15edb97611faf1($fileIdentifier, $file);
     56            composerRequiredceed942811feb8a045169f778363db6($fileIdentifier, $file);
    5757        }
    5858
     
    6161}
    6262
    63 function composerRequiref09e17fb75429ec5fb15edb97611faf1($fileIdentifier, $file)
     63function composerRequiredceed942811feb8a045169f778363db6($fileIdentifier, $file)
    6464{
    6565    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • writing-on-github/trunk/vendor/composer/autoload_static.php

    r1713654 r1719790  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitf09e17fb75429ec5fb15edb97611faf1
     7class ComposerStaticInitdceed942811feb8a045169f778363db6
    88{
    99    public static $files = array (
     
    3535    {
    3636        return \Closure::bind(function () use ($loader) {
    37             $loader->classMap = ComposerStaticInitf09e17fb75429ec5fb15edb97611faf1::$classMap;
     37            $loader->classMap = ComposerStaticInitdceed942811feb8a045169f778363db6::$classMap;
    3838
    3939        }, null, ClassLoader::class);
  • writing-on-github/trunk/views/options.php

    r1709881 r1719790  
    1818            </tr>
    1919            <tr>
    20                 <th scope="row"><?php esc_html_e( 'Bulk actions', 'writing-on-github' ); ?></th>
    21                 <td>
    22                     <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'export' ) ) ); ?>">
    23                         <?php esc_html_e( 'Export to GitHub', 'writing-on-github' ); ?>
    24                     </a> |
    25                     <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'force_export' ) ) ); ?>">
    26                         <?php esc_html_e( 'Force export to GitHub', 'writing-on-github' ); ?>
    27                     </a> |
    28                     <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'import' ) ) ); ?>">
    29                         <?php esc_html_e( 'Import from GitHub', 'writing-on-github' ); ?>
    30                     </a>
    31                 </td>
     20                <th scope="row"><?php esc_html_e( 'Export', 'writing-on-github' ); ?></th>
     21                <td>
     22                    <p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'export' ) ) ); ?>">
     23                        <input type="button" class="button button-secondary" value="<?php esc_html_e( 'Export to GitHub', 'writing-on-github' ); ?>" />
     24                    </a></p>
     25                    <p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'force_export' ) ) ); ?>">
     26                        <input type="button" class="button button-secondary" value="<?php esc_html_e( 'Force export to GitHub', 'writing-on-github' ); ?>" />
     27                    </a></p>
     28                </td>
     29            </tr>
     30            <tr>
     31                <th scope="row"><?php esc_html_e( 'Import', 'writing-on-github' ); ?></th>
     32                <td>
     33                    <p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'import' ) ) ); ?>">
     34                        <input type="button" class="button button-secondary" value="<?php esc_html_e( 'Import from GitHub', 'writing-on-github' ); ?>" />
     35                    </a></p>
     36                     <p><a href="<?php echo esc_url( add_query_arg( array( 'action' => 'force_import' ) ) ); ?>">
     37                        <input type="button" class="button button-secondary" value="<?php esc_html_e( 'Force Import from GitHub', 'writing-on-github' ); ?>" />
     38                    </a></p>
     39                </td>
     40            </tr>
    3241        </table>
    3342        <?php submit_button(); ?>
  • writing-on-github/trunk/writing-on-github.php

    r1713654 r1719790  
    44 * Plugin URI: https://github.com/litefeel/writing-on-github
    55 * Description: A WordPress plugin to allow you writing on GitHub (or Jekyll site).
    6  * Version: 1.6.1
     6 * Version: 1.7
    77 * Author:  litefeel
    88 * Author URI: https://www.litefeel.com
     
    133133        add_action( 'wp_ajax_nopriv_wogh_push_request', array( $this->controller, 'pull_posts' ) );
    134134        add_action( 'wogh_export', array( $this->controller, 'export_all' ), 10, 2 );
    135         add_action( 'wogh_import', array( $this->controller, 'import_master' ), 10, 1 );
     135        add_action( 'wogh_import', array( $this->controller, 'import_master' ), 10, 2 );
    136136        add_filter( 'get_edit_post_link', array( $this, 'edit_post_link' ), 10, 3 );
    137137
     
    218218     * Sets and kicks off the import cronjob
    219219     */
    220     public function start_import() {
    221         $this->start_cron( 'import' );
     220    public function start_import( $force = false ) {
     221        $this->start_cron( 'import', $force );
    222222    }
    223223
Note: See TracChangeset for help on using the changeset viewer.