From b34168327fe3e86dea47d2eee30806c54d0faf05 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Fri, 3 Jun 2011 20:34:54 +0200 Subject: [PATCH] Checking that we can execute wget. --- wordpress/plugins/owark/owark.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wordpress/plugins/owark/owark.php b/wordpress/plugins/owark/owark.php index 9a865cd..11c8e7a 100644 --- a/wordpress/plugins/owark/owark.php +++ b/wordpress/plugins/owark/owark.php @@ -128,6 +128,31 @@ if (!class_exists("Owark")) { } } + // Check that we can execute commands + + if ( ini_get('disable_functions') ) { + $not_allowed = ini_get('disable_functions'); + if ( stristr($not_allowed, 'exec') || stristr($not_allowed, 'passthru') ) { + $this->notices = $this->notices . "

The Open Web Archives requires that exec() and passthru() are allowed to run wget and retrieve the pages to archive.

"; + } + } + + // Check that wget is installed + + $output = array(); + exec('/usr/bin/wget -V', &$output); + + + if ( empty($output) ) { + $this->notices = $this->notices . "

The Open Web Archives is not able to run wget and retrieve the pages to archive. Please check that wget is installed and on the default path.

"; + } + + // We need as least version 1.12 or higher + $helper = preg_match('/GNU Wget ([0-9\.]+) /', $output[0], $wget_version); + if ( $wget_version[1] < '1.12' ) { + $this->notices = $this->notices . "

The Open Web Archives needs wget version 1.12 or higher.
Version read: {$wget_version[0]}

"; + } + if ($this->notices != '') { add_action('admin_notices', array($this, 'admin_notices')); }