diff --git a/.gitignore b/.gitignore index 68903a283..592e08b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ openml_OS/third_party/OpenML/Java/old-evaluate.jar docs/site/ *.icloud *.DS_store +openml_OS/vendor/ +openapi/vendor/ diff --git a/README.md b/README.md index c96c9d261..76b2b800e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ + [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +> [!WARNING] +> This repository is in maintenance-only mode. We're phasing out the PHP-based REST API in favor of a much more modern [FastAPI-based API](https://github.com/openml/server-api). +> For more details, please check the [contribution guide](https://github.com/openml). + + OpenML: Open Machine Learning ============================= Welcome to the OpenML GitHub page! :tada: diff --git a/docker/config/php.ini b/docker/config/php.ini index 6f97900dd..4f5df2792 100644 --- a/docker/config/php.ini +++ b/docker/config/php.ini @@ -710,7 +710,7 @@ auto_globals_jit = On ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. ; https://php.net/post-max-size -post_max_size = 8M +post_max_size = 5G ; Automatically add files before PHP document. ; https://php.net/auto-prepend-file @@ -862,7 +862,7 @@ file_uploads = On ; Maximum allowed size for uploaded files. ; https://php.net/upload-max-filesize -upload_max_filesize = 2M +upload_max_filesize = 4G ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 diff --git a/docker/set_configuration.sh b/docker/set_configuration.sh index b579dff69..ae1c13822 100755 --- a/docker/set_configuration.sh +++ b/docker/set_configuration.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -euxo pipefail + # TODO: read credentials from secrets instead OPENML_PATH=${OPENML_PATH:-/var/www/} BASE_CONFIG_PATH=${OPENML_PATH}openml/openml_OS/config/BASE_CONFIG.php @@ -30,14 +32,17 @@ sed "s*'ES_PASSWORD', 'FILL_IN'*'ES_PASSWORD', '${ES_PASSWORD:-default}'*g" --in sed "s/define('ENVIRONMENT', '.*')/define('ENVIRONMENT', '${PHP_ENVIRONMENT:-production}')/" --in-place ${INDEX_PATH} +cd /var/www/openml -indices=('downvote', 'study', 'data', 'task', 'download', 'user', 'like', 'measure', 'flow', 'task_type', 'run') -for index in "${indices[@]}" -do - curl -X DELETE ${ES_URL:-elasticsearch:9200}/${index}?ignore_unavailable=true -done +INDEX_ES_DURING_STARTUP=${INDEX_ES_DURING_STARTUP:-true} +if [ "$INDEX_ES_DURING_STARTUP" = true ] ; then + indices=('downvote', 'study', 'data', 'task', 'download', 'user', 'like', 'measure', 'flow', 'task_type', 'run') + for index in "${indices[@]}" + do + curl -X DELETE ${ES_URL:-elasticsearch:9200}/${index}?ignore_unavailable=true + done -cd /var/www/openml -php index.php cron build_es_indices + php index.php cron build_es_indices +fi apache2-foreground diff --git a/openml_OS/helpers/file_upload_helper.php b/openml_OS/helpers/file_upload_helper.php index d11a0ef86..b0c02c82c 100644 --- a/openml_OS/helpers/file_upload_helper.php +++ b/openml_OS/helpers/file_upload_helper.php @@ -1,18 +1,19 @@ 0) { // php error generated $message = 'Upload Error ' . $file['error'] . ': ' . upload_error_message($file['error']); return false; + } else if($file['size'] == 0) { + $message = 'Filesize is 0 bytes, which is not allowed. '; + return false; } else if(!file_exists($file['tmp_name'])) { // file doesn't exist $message = 'File not present at expected location. '; return false; diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index 6778206b1..294d13002 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -581,6 +581,7 @@ private function data_fork() { $latest_version = $this->Dataset-> getWhereSingle('`name` = "' . $dataset->name . '"', 'CAST(`version` AS DECIMAL) DESC'); $dataset->version = $latest_version->version + 1; unset($dataset->did); + $new_data_id = $this->Dataset->insert($dataset); if (!$new_data_id) { $this->returnError(1072, $this->version); @@ -934,7 +935,6 @@ private function data_reset($data_id) { * ), *) */ - private function data_add_topic($id, $topic) { # Data id and topic are required if ($id == false || $topic == false) { @@ -1281,6 +1281,7 @@ private function data_upload() { $this->returnError(134, $this->version); return; } + $desc['did'] = $id; $desc_id = $this->Dataset_description->insert($desc); if (!$desc_id) { @@ -1616,8 +1617,9 @@ private function data_features_upload() { } // get correct description - if (isset($_FILES['description']) == false || check_uploaded_file($_FILES['description']) == false) { - $this->returnError(442, $this->version); + $message = ''; + if (isset($_FILES['description']) == false || check_uploaded_file($_FILES['description'], false, $message) == false) { + $this->returnError(442, $this->version, $this->openmlGeneralErrorCode, 'Error: ' . $message); return; } @@ -1734,7 +1736,7 @@ private function data_features_upload() { } else { $nominal_values = false; } - + //actual insert of the feature if (array_key_exists('ontology', $feature)) { $ontologies = $feature['ontology']; diff --git a/openml_OS/models/api/v1/Api_study.php b/openml_OS/models/api/v1/Api_study.php index 63fd9b53e..45e392247 100644 --- a/openml_OS/models/api/v1/Api_study.php +++ b/openml_OS/models/api/v1/Api_study.php @@ -629,9 +629,11 @@ private function study_list($segs) { if ($status != 'all') { $whereClause .= ' AND status = "' . $status . '"'; } - } else { + } + /** Don't enforce that status must be active by default since we don't have an automated status check + else { $whereClause .= ' AND status = "active"'; - } + }*/ $studies = $this->Study->getWhere($whereClause, null, $limit, $offset); if (!$studies) { diff --git a/openml_OS/third_party/OpenML/Java/evaluate.jar b/openml_OS/third_party/OpenML/Java/evaluate.jar index a46bc3d66..59f38d9a7 100644 Binary files a/openml_OS/third_party/OpenML/Java/evaluate.jar and b/openml_OS/third_party/OpenML/Java/evaluate.jar differ diff --git a/openml_OS/views/pages/api_new/v1/xml/pre.php b/openml_OS/views/pages/api_new/v1/xml/pre.php index 98846dad7..75b4a8f8c 100644 --- a/openml_OS/views/pages/api_new/v1/xml/pre.php +++ b/openml_OS/views/pages/api_new/v1/xml/pre.php @@ -529,7 +529,6 @@ $this->apiErrors[1071] = 'Unknown dataset'; $this->apiErrors[1072] = 'Failed to insert record in database'; - //openml.data.topic $this->apiErrors[1080] = 'Please provide a dataset id and a topic.'; $this->apiErrors[1081] = 'Unknown dataset.'; @@ -551,5 +550,4 @@ $this->apiErrors[1104] = 'Failure to write to the database'; $this->apiErrors[1105] = 'Feature description too long'; $this->apiErrors[1106] = 'Feature description meant as ontology, but is not a valid URL'; - ?>