Changeset 11232
- Timestamp:
- 09/14/2021 07:19:00 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
- Files:
-
- 1 added
- 3 edited
-
jobs/class-manager.php (modified) (3 diffs)
-
jobs/class-svn-import.php (added)
-
lib/class-exec-with-logging.php (modified) (4 diffs)
-
theme-directory.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/jobs/class-manager.php
r6289 r11232 28 28 // A cronjob to check cronjobs. 29 29 add_action( 'theme_directory_check_cronjobs', [ $this, 'register_cron_tasks' ] ); 30 31 // Import from SVN tasks. 32 add_action( 'theme_directory_svn_import_watcher', [ __NAMESPACE__ . '\SVN_Import', 'watcher_trigger' ] ); 33 add_action( 'theme_directory_svn_import', [ __NAMESPACE__ . '\SVN_Import', 'import_trigger' ] ); 30 34 } 31 35 … … 42 46 'interval' => 15 * MINUTE_IN_SECONDS, 43 47 'display' => 'Every 15 minutes', 48 ]; 49 50 $schedules['every_5m'] = [ 51 'interval' => 5 * MINUTE_IN_SECONDS, 52 'display' => 'Every 5 minutes', 44 53 ]; 45 54 … … 60 69 wp_schedule_event( time() + 60, 'every_15m', 'theme_directory_check_cronjobs' ); 61 70 } 71 72 if ( ! wp_next_scheduled( 'theme_directory_svn_import_watcher' ) ) { 73 wp_schedule_event( time() + 60, 'every_5m', 'theme_directory_svn_import_watcher' ); 74 } 62 75 } 63 76 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/lib/class-exec-with-logging.php
r11230 r11232 3 3 4 4 /** 5 * Simple `exec()` wrapper which addserror reporting to WordPress.org.5 * Simple `exec()` wrappers which add error reporting to WordPress.org. 6 6 * 7 * @package WordPressdotorg\Theme_Directory 7 * @package WordPressdotorg\Theme_Directory\Lib 8 8 */ 9 9 trait Exec_With_Logging { … … 18 18 * @return false|string False on failure, last line of output on success, as per exec(). 19 19 */ 20 public function exec( $command, &$output = null, &$return_var = null ) {20 public static function exec( $command, &$output = null, &$return_var = null ) { 21 21 $proc = proc_open( 22 22 $command, … … 27 27 $pipes 28 28 ); 29 30 if ( ! $proc ) { 31 return false; 32 } 29 33 30 34 $stdout = stream_get_contents( $pipes[1] ); … … 77 81 } 78 82 83 /** 84 * Execute a shell process, same behaviour as `shell_exec()` but with PHP Warnings/Notices generated on errors. 85 * 86 * @param string $command Command to execute. Escape it. 87 * 88 * @return false|string False on failure, output on success, mostly per shell_exec(). 89 */ 90 public static function shell_exec( $command ) { 91 $output = []; 92 $return_var = 0; 93 $return = self::exec( $command, $output, $return_var ); 94 95 // Diverge from shell_exec(): return false for any error. 96 if ( $return_var > 0 || false === $return || ! $output ) { 97 return false; 98 } 99 100 return implode( "\n", $output ); 101 } 79 102 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r11231 r11232 27 27 include __DIR__ . '/query-modifications.php'; 28 28 29 // Load the GitHub API client. 30 include __DIR__ . '/lib/class-github.php'; 31 include __DIR__ . '/lib/class-exec-with-logging.php'; 32 29 33 // Load repo jobs. 30 34 include __DIR__ . '/jobs/class-manager.php'; 31 35 include __DIR__ . '/jobs/class-trac-sync.php'; 36 include __DIR__ . '/jobs/class-svn-import.php'; 32 37 new WordPressdotorg\Theme_Directory\Jobs\Manager(); 33 34 // Load the GitHub API client.35 include __DIR__ . '/lib/class-github.php';36 include __DIR__ . '/lib/class-exec-with-logging.php';37 38 38 39 // Load the Rest API Endpoints.
Note: See TracChangeset
for help on using the changeset viewer.