diff --git a/lib/plugins/usermanager/_test/csv_import.test.php b/lib/plugins/usermanager/_test/csv_import.test.php index 3968356bc91605bcdc6a58077104522b05ffa94a..1f0ee74368d6f9e7134b70eb37d20a9495833481 100644 --- a/lib/plugins/usermanager/_test/csv_import.test.php +++ b/lib/plugins/usermanager/_test/csv_import.test.php @@ -150,20 +150,6 @@ importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user $this->doImportTest($csv, true, $expected, array()); } - /** - * Verify usermanager::str_getcsv() behaves identically to php 5.3's str_getcsv() - * within the context/parameters required by _import() - * - * @requires PHP 5.3 - * @deprecated remove when dokuwiki requires 5.3+ - * also associated usermanager & mock usermanager access methods - */ - function test_getcsvcompatibility() { - $line = 'importuser,"Ford Prefect",ford@example.com,user'.NL; - - $this->assertEquals(str_getcsv($line), $this->usermanager->access_str_getcsv($line)); - } - private function stripPasswords($array){ foreach ($array as $user => $data) { unset($array[$user]['pass']); diff --git a/lib/plugins/usermanager/_test/mocks.class.php b/lib/plugins/usermanager/_test/mocks.class.php index 91c74768c1ff6af03d9377859eb01fd145351528..f3cc72c2730740173d630ce5cdec8b929eebc202 100644 --- a/lib/plugins/usermanager/_test/mocks.class.php +++ b/lib/plugins/usermanager/_test/mocks.class.php @@ -26,14 +26,6 @@ class admin_mock_usermanager extends admin_plugin_usermanager { return $this->_import(); } - /** - * @deprecated remove when dokuwiki requires php 5.3+ - * also associated unit test & usermanager methods - */ - public function access_str_getcsv($line){ - return $this->str_getcsv($line); - } - // no need to send email notifications (mostly) protected function _notifyUser($user, $password, $status_alert=true) { if ($this->mock_email_notifications) { diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index f90a172b3b7abedae44c903c8a5d9d93578f51b9..6d9bf3b202bbd5067f9338e9523ed57500f3fe35 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -942,7 +942,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { if (!utf8_check($csv)) { $csv = utf8_encode($csv); } - $raw = $this->_getcsv($csv); + $raw = str_getcsv($csv); $error = ''; // clean out any errors from the previous line // data checks... if (1 == ++$line) { @@ -1080,37 +1080,4 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { protected function _isUploadedFile($file) { return is_uploaded_file($file); } - - /** - * wrapper for str_getcsv() to simplify maintaining compatibility with php 5.2 - * - * @deprecated remove when dokuwiki php requirement increases to 5.3+ - * also associated unit test & mock access method - * - * @param string $csv string to parse - * @return array - */ - protected function _getcsv($csv) { - return function_exists('str_getcsv') ? str_getcsv($csv) : $this->str_getcsv($csv); - } - - /** - * replacement str_getcsv() function for php < 5.3 - * loosely based on www.php.net/str_getcsv#88311 - * - * @deprecated remove when dokuwiki php requirement increases to 5.3+ - * - * @param string $str string to parse - * @return array - */ - protected function str_getcsv($str) { - $fp = fopen("php://temp/maxmemory:1048576", 'r+'); // 1MiB - fputs($fp, $str); - rewind($fp); - - $data = fgetcsv($fp); - - fclose($fp); - return $data; - } }