Skip to content

Commit

Permalink
adding activation hook and exif permission catch.
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Aug 24, 2020
1 parent e5a8d43 commit 464de75
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions photopress.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Author: Peter Adams
Author URI: http://www.photopressdev.com
License: GPL v3
Version: 1.3.4
Version: 1.3.5
*/

// If this file is called directly, abort.
Expand All @@ -30,13 +30,11 @@
define('PHOTOPRESS_FRAMEWORK_PATH', PHOTOPRESS_CORE_PATH . 'framework/' );
}

// Include the Photopress API which can be used by other plugins
//require_once PHOTOPRESS_FRAMEWORK_PATH . 'class-pp-api.php';

// Hook for plugin package creation
add_action('plugins_loaded', array( 'photopress_plugin', 'getInstance'), 1 );
add_action('plugins_loaded', [ 'photopress_plugin', 'getInstance' ], 1 );

register_activation_hook(__FILE__, [ 'photopress_plugin', 'activate' ] );

//require_once ( plugin_dir_path( __FILE__ ) . 'src/init.php' );

/**
* PhotoPress Core Plugin
Expand Down Expand Up @@ -77,7 +75,7 @@ public static function getInstance() {
array(
'package_name' => 'core',
'package_label' => 'PhotoPress',
'version' => '1.3.4',
'version' => '1.3.5',
'modules' => ['base', 'childpages', 'gallery', 'slideshow', 'metadata'],
'dependencies' => []
)
Expand Down Expand Up @@ -145,6 +143,19 @@ public function random_gallery_taxonomy_query( $attachments, $attr ) {
// always return something so downstream plugins can operate.
return $attachments;
}

public static function activate() {

$exiftool_path = PHOTOPRESS_CORE_PATH . 'vendor/philharvey/exiftool/exiftool ';
if ( function_exists( 'chmod' ) ) {
photopress_util::debug( $exiftool_path );
$ret = chmod( trim($exiftool_path), 0755 );
photopress_util::debug( $ret );
} else {

photopress_util::debug('cannot set executable permission on exiftool. please manually change to 755.');
}
}
}

?>

0 comments on commit 464de75

Please sign in to comment.