summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/includes/restfunctions.php
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-01-12 11:56:30 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-01-12 13:50:13 +0100
commit55e32e9cc08972ac64a745a6c7bee9a181be3c47 (patch)
tree90cc8deab39f8560879091c3824320abaadf6d01 /admin/WebConsole/includes/restfunctions.php
parent06d220975c26b86537a9055f897177550919b8fc (diff)
#1008 Restore support for >4 partitions
WebConsole "Partition and Format"/"Particionar y Formatear" supported more than 4 partitions when it used SocketHidra. When we changed it to use HTTP requests we introduced a limit of 4 partitions. This commit: * Restores "Partition and Format" support for more than 4 partitions. * Adapts client-side checks (JavaScript) for more than 4 partitions and GPT.
Diffstat (limited to 'admin/WebConsole/includes/restfunctions.php')
-rw-r--r--admin/WebConsole/includes/restfunctions.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index 8d8bf931..d45dd9c9 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -85,6 +85,7 @@ define('TYPE_TASK', 3);
define('OG_SCHEDULE_COMMAND', 'command');
define('OG_SCHEDULE_PROCEDURE', 'procedure');
define('OG_SCHEDULE_TASK', 'task');
+define('PART_MAX_NUM_FIELDS', 5);
$conf_file = json_decode(file_get_contents(__DIR__ . '/../../etc/ogserver.json'), true);
define('OG_REST_API_TOKEN', 'Authorization: ' . $conf_file['rest']['api_token']);
@@ -551,7 +552,8 @@ function setup($string_ips, $params) {
$file_system = array();
$part_size = array();
$format = array();
- for ($x = 0; $x < 4; $x++) {
+ $num_partitions = (sizeof($matches[0]) - 5) / PART_MAX_NUM_FIELDS;
+ for ($x = 0; $x < $num_partitions; $x++) {
$partition_number[$x] = $matches[0][5 + 5 * $x];
$partition_code[$x] = $matches[0][6 + 5 * $x];
$file_system[$x] = $matches[0][7 + 5 * $x];