How to use create_backup method of backup class

Best Phoronix-test-suite code snippet using backup.create_backup

bits-backup-spec.php

Source:bits-backup-spec.php Github

copy

Full Screen

...16$worker = new BitsBackupWorker($api);17$api->set_api_key($api_key);18$backup_state_machine = new BitsBackupStateMachine($api);19$restore_state_machine = new BitsRestoreStateMachine($api);20function create_backup($api, $opts=array()) {21 $api_key = $api->create_api_key();22 $api->set_api_key($api_key);23 return $api->create_backup($opts);24}25function pass() {26 echo "<span style='color:#8b8;font-weight:bold;'>PASS</span>";27}28function fail($obj) {29 echo "<span style='color:#b88;font-weight:bold;'>FAIL</span><br>";30 echo "<pre>";31 var_dump($obj);32 echo "</pre>";33}34?>35<table>36 <tr>37 <th>Test name</th>38 <th>Status</th>39 </tr>40 <tr>41 <th colspan="2"> API - Backup </th>42 </tr>43 <tr>44 <td>API Create backup</td>45 <td>46 <?php47 $result = create_backup($api, array( "test" => "true" ));48 if(!is_wp_error($result) && $result["id"] > 0) { pass(); } else { fail($result); };49 ?>50 </td>51 </tr>52 <tr>53 <td>API get backups(empty)</td>54 <td>55 <?php56 $result = create_backup($api, array( "test" => "true" ));57 if(is_array($result)) { pass(); } else { fail($result); };58 ?>59 </td>60 </tr>61 <tr>62 <td>API get a backup</td>63 <td>64 <?php65 $backup = create_backup($api, array( "test" => "true" ));66 $result = $api->get_backup($backup["id"]);67 if($result["id"] == $backup["id"]) { pass(); } else { fail($result); };68 ?>69 </td>70 </tr>71 <tr>72 <td>API error on null get_backup</td>73 <td>74 <?php75 $result = $api->get_backup(null);76 if(is_wp_error($result)) { pass(); } else { fail($result); };77 ?>78 </td>79 </tr>80 <tr>81 <td>API commit backup (empty)</td>82 <td>83 <?php84 $backup = create_backup($api, array( "test" => "true" ));85 $result = $api->commit_backup($backup["id"]);86 if($result["id"] == $backup["id"]) { pass(); } else { fail($result); };87 ?>88 </td>89 </tr>90 <tr>91 <td>API add to backup (schema doesn't exist)</td>92 <td>93 <?php94 $backup = create_backup($api, array( "test" => "true" ));95 $result = $api->add_schemas_to_backup($backup["id"], ['no-exist'] );96 if(97 !is_wp_error($result) &&98 count($result["schemas"]) == 1 &&99 $result['schemas'][0]['status'] == 200100 ) { pass(); } else { fail($result); };101 ?>102 </td>103 </tr>104 105 <tr>106 <td>API can ignore AUTO_INCREMENT=\d+ in schemas</td>107 <td>108 <?php109 function test_replace_autoincrement($api, $str, $res) {110 if($api->schema_fingerprint_replace_autoincrement($str) != $res) {111 $was = $api->schema_fingerprint_replace_autoincrement($str);112 fail("remove autoincrement from:<br/>$str<br/> is not equal to: <br/>$res<br/> was: <br/>$was");113 return false;114 }115 return true;116 }117 $auto = "CREATE TABLE `wp_options` ( `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `option_name` varchar(64) NOT NULL DEFAULT '', `option_value` longtext NOT NULL, `autoload` varchar(20) NOT NULL DEFAULT 'yes', PRIMARY KEY (`option_id`), UNIQUE KEY `option_name` (`option_name`) ) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8";118 $no_auto = "CREATE TABLE `wp_options` ( `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `option_name` varchar(64) NOT NULL DEFAULT '', `option_value` longtext NOT NULL, `autoload` varchar(20) NOT NULL DEFAULT 'yes', PRIMARY KEY (`option_id`), UNIQUE KEY `option_name` (`option_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8";119 if(test_replace_autoincrement($api, "AUTO_INCREMENT=", "AUTO_INCREMENT=") && 120 test_replace_autoincrement($api, $auto, $no_auto) && 121 test_replace_autoincrement($api, $no_auto, $no_auto)122 ) {123 pass();124 } 125 ?>126 </td>127 </tr>128 <tr>129 <td>API add file to backup</td>130 <td>131 <?php132 $backup = create_backup($api, array( "test" => "true" ));133 $files = array(134 $WP_PATH."/wp-config.php" => "http://test.test/path/to/file"135 );136 $result = $api->add_files_to_backup($backup['id'], $files);137 if(138 count($result["files"]) == 1139 ) { pass(); } else { fail($result); };140 ?>141 </td>142 </tr>143 <tr>144 <td>API upload_files return fingerprints</td>145 <td>146 <?php147 file_put_contents($WP_PATH."/tmpfile", substr(md5(rand()), 0, 7));148 $files = array($WP_PATH."/tmpfile");149 $sha1 = sha1_file($files[0]);150 $results = $api->upload_files($files, 0, BitsUtil::fs_get_wp_config_path());151 if(152 count($results) == count($files) &&153 reset($results) == $sha1154 ) { pass(); } else { fail($results); };155 ?>156 </td>157 </tr>158 159 <tr>160 <td>API content_fingerprint that is passed in is used by add_files_to_backup</td>161 <td>162 <?php163 $backup = create_backup($api, array( "test" => "true" ));164 file_put_contents($WP_PATH."/tmpfile", substr(md5(rand()), 0, 7));165 $files = array($WP_PATH."/tmpfile");166 $sha1 = sha1_file($files[0]);167 $results = $api->upload_files($files, 0, BitsUtil::fs_get_wp_config_path());168 file_put_contents($WP_PATH."/tmpfile", substr(md5(rand()), 0, 7));169 $files = $results;170 $result = $api->add_files_to_backup($backup['id'], $files);171 if(172 count($result["files"]) == 1173 ) { pass(); } else { fail($result); };174 ?>175 </td>176 </tr> 177 <tr>178 <td>API handles sym links</td>179 <td>180<?php181 $meta = $api->get_file_metadata($api->root . "/wp-content/plugins/anybackup");182 if(183 $meta["type"] == "directory" &&184 $meta['content_fingerprint'] == null185 ) { pass(); } else { fail($meta); };186?>187 </td>188 </tr>189 <tr>190 <td>API fresh backup, next step is scan_schema</td>191 <td>192 <?php193 $backup = create_backup($api, array( "test" => "true" ));194 $result = $api->next_step();195 if(196 $result["step"] == "scan_schema"197 ) { pass(); } else { fail($result); };198 ?>199 </td>200 </tr>201 202 <tr>203 <td>API step scan_schema completes</td>204 <td>205 <?php206 $backup = create_backup($api, array( "test" => "true" ));207 $step = $api->next_step();208 $result = $api->complete_step($step["step_id"]);209 if(210 $result["step_status"] == "COMPLETE"211 ) { pass(); } else { fail($result); };212 ?>213 </td>214 </tr> <tr>215 <th colspan="2"> API - Restore </th>216 </tr>217 <tr>218 <td>API restore create</td>219 <td>220 <?php221 $backup = create_backup($api, array( "test" => "true" ));222 $commit = $api->commit_backup($backup["id"]);223 $result = $api->create_restore($backup["id"]);224 if($result["status"] == 200 && $result['id'] > 0) { pass(); } else { fail($result); };225 ?>226 </td>227 </tr>228 <tr>229 <td>API restore get schemas</td>230 <td>231 <?php232 $backup = create_backup($api, array( "test" => "true" ));233 $commit = $api->commit_backup($backup["id"]);234 $restore = $api->create_restore($backup["id"]);235 $result = $api->get_restore_schemas($restore["id"]);236 if($result["status"] == 200 && count($result['schemas']) == 0) { pass(); } else { fail($result); };237 ?>238 </td>239 </tr>240 <tr>241 <td>API restore get rows (404)</td>242 <td>243 <?php244 $backup = create_backup($api, array( "test" => "true" ));245 $commit = $api->commit_backup($backup["id"]);246 $restore = $api->create_restore($backup["id"]);247 $result = $api->get_restore_rows($restore["id"], "schema-not-exist", 0);248 if(is_wp_error($result) ) { pass(); } else { fail($result); };249 ?>250 </td>251 </tr>252 <tr>253 <td>API restore get missing files</td>254 <td>255 <?php256 $backup = create_backup($api, array( "test" => "true" ));257 $commit = $api->commit_backup($backup["id"]);258 $restore = $api->create_restore($backup["id"]);259 $files = array();260 $result = $api->restore_missing_files($restore['id'], $files);261 if($result["missing_files"] == [] ) { pass(); } else { fail($result); };262 ?>263 </td>264 </tr>265 <tr>266 <td>API restore get file operations needed</td>267 <td>268 <?php269 $backup = create_backup($api, array( "test" => "true" ));270 $commit = $api->commit_backup($backup["id"]);271 $restore = $api->create_restore($backup["id"]);272 $files = array();273 $result = $api->restore_file_operations($restore['id'], $files);274 if(!is_wp_error($result) && $result == []) { pass(); } else { fail($result); };275?>276 </td>277 </tr> <tr>278 <td>API restore swap schema operations</td>279 <td>280 <?php281 $backup = create_backup($api, array( "test" => "true" ));282 $commit = $api->commit_backup($backup["id"]);283 $restore = $api->create_restore($backup["id"]);284 $result = $api->swap_schema_operations($restore["id"]);285 if(!is_wp_error($result) && count($result) == 11) { pass(); } else { fail($result); };286 ?>287 </td>288 </tr>289 <tr>290 <td>API restore get restore operations - delete file</td>291 <td>292 <?php293 $backup = create_backup($api, array( "test" => "true" ));294 $commit = $api->commit_backup($backup["id"]);295 $restore = $api->create_restore($backup["id"]);296 $files = array(BitsUtil::fs_get_wp_config_path()."./index.php");297 $result = $api->restore_file_operations($restore["id"], $files);298 if(!is_wp_error($result) && count($result) == 1) { pass(); } else { fail($result); };299 ?>300 </td>301 </tr>302 <tr>303 <th colspan="2"> API - Util </th>304 </tr>305 <tr>306 <td>API select_404_results - empty</td>307 <td>308 <?php309 $backup = create_backup($api, array( "test" => "true" ));310 $result = $api->select_404_results([], []);311 if(count($result) == 0) { pass(); } else { fail($result); };312 ?>313 </td>314 </tr>315 <tr>316 <td>API select_404_results - one 404</td>317 <td>318 <?php319 $missing = array( "status" => 404 );320 $success = array( "status" => 200 );321 $entry1 = array("a" => "b");322 $entry2 = array("c" => "d");323 $result = $api->select_404_results([$success, $missing], [$entry1, $entry2]);324 if($result[0] == $entry2 && sizeof($result) == 1) { pass(); } else { fail($result); };325 ?>326 </td>327 </tr>328 <tr>329 <td>API get schemas (schema doesn't exist)</td>330 <td>331 <?php332 $result = $api->get_schemas(["not-exist", "not-exist-2"]);333 if(count($result) == 2) { pass(); } else { fail($result); };334 ?>335 </td>336 </tr>337 <tr>338 <td>API creates schemas</td>339 <td>340 <?php341 $result = $api->create_schemas(["test", "test2"]);342 if(count($result) == 2) { pass(); } else { fail($result); };343 ?>344 </td>345 </tr>346 <tr>347 <td>API get rows </td>348 <td>349 <?php350 $result = $api->get_rows(["xx"]);351 if(count($result) == 1) { pass(); } else { fail($result); };352 ?>353 </td>354 </tr>355 <tr>356 <td>API create rows </td>357 <td>358 <?php359 $schema = "test".microtime();360 $result = $api->create_schemas([$schema]);361 $row1 = array( "content" => array( "field", "".microtime() ), "schema" => sha1($schema));362 $row2 = array( "content" => array( "field", "".microtime() . 1 ), "schema" => sha1($schema));363 $result = $api->create_rows([ $row1, $row2 ]);364 if(count($result) == 2 && $result[0]["status"] == 200) { pass(); } else { fail($result); };365 ?>366 </td>367 </tr>368 <tr>369 <td>API get row groups </td>370 <td>371 <?php372 $result = $api->get_row_groups(["xx"]);373 if(count($result) == 1) { pass(); } else { fail($result); };374 ?>375 </td>376 </tr>377 <tr>378 <td>API create row group </td>379 <td>380 <?php381 $schema = "test".microtime();382 $result = $api->create_schemas([$schema]);383 $row1 = array( "content" => array( "field", microtime() ), "schema" => sha1($schema));384 $row_result = $api->create_rows([ $row1 ]);385 $row_group1 = array( "rows" => [ "not-found" ], "schema" => sha1($schema) );386 $result = $api->create_row_groups(array(array("schema" => sha1($schema), "rows" => [$row1])));387 if(count($result) == 1 && $result[0]["status"] == 200) { pass(); } else { fail($result); };388 ?>389 </td>390 </tr>391 <tr>392 <td>API Add missing row group </td>393 <td>394 <?php395 $backup = create_backup($api, array( "test" => "true" ));396 $result = $api->create_schemas(["test"]);397 $row1 = array("a" => "b");398 $row2 = array("a" => "c");399 $result = $api->add_rows_to_backup($backup["id"], [$row1, $row2], "test");400 if(count($result) == 2) { pass(); } else { fail($result); };401 ?>402 </td>403 </tr> 404 <tr>405 <td>API row fingerprints with same data are equal</td>406 <td>407 <?php408 $content = array("a" => "b");409 $row1 = array( "content" => $content, "schema" => "1" );410 $row2 = array( "content" => $content, "schema" => "1" );411 $fingerprint1 = $api->fingerprint_for_row($row1);412 $fingerprint2 = $api->fingerprint_for_row($row2);413 if($fingerprint1 == $fingerprint2) { pass(); } else { fail($result); };414 ?>415 </td>416 </tr>417 <tr>418 <td>API row fingerprint includes schema</td>419 <td>420 <?php421 $content = array("a" => "b");422 $row1 = array( "content" => $content, "schema" => "1" );423 $row2 = array( "content" => $content, "schema" => "2" );424 $fingerprint1 = $api->fingerprint_for_row($row1);425 $fingerprint2 = $api->fingerprint_for_row($row2);426 if($fingerprint1 != $fingerprint2) { pass(); } else { fail([$fingerprint1, $fingerprint2]); };427 ?>428 </td>429 </tr> 430 <tr>431 <td>API row fingerprint content order doesn't matter</td>432 <td>433 <?php434 $content1 = array("a" => "b", "c" => "d");435 $content2 = array("c" => "d", "a" => "b");436 $row1 = array( "content" => $content1, "schema" => "1" );437 $row2 = array( "content" => $content2, "schema" => "1" );438 $fingerprint1 = $api->fingerprint_for_row($row1);439 $fingerprint2 = $api->fingerprint_for_row($row2);440 if($fingerprint1 == $fingerprint2) { pass(); } else { fail([$fingerprint1, $fingerprint2]); };441 ?>442 </td>443 </tr> 444 <tr>445 <td>API row_group row content order doesn't matter</td>446 <td>447 <?php448 $schema = "CREATE TABLE test";449 $content1 = array("a" => "b", "c" => "d");450 $content2 = array("c" => "d", "a" => "b");451 $row1 = array( "content" => $content1, "schema" => $schema);452 $row2 = array( "content" => $content2, "schema" => $schema);453 $row_group1 = array("rows" => [$row1, $row2], "schema" => $schema);454 $row_group2 = array("rows" => [$row1, $row2], "schema" => $schema);455 $fingerprint1 = $api->fingerprint_for_row_group($row_group1);456 $fingerprint2 = $api->fingerprint_for_row_group($row_group2);457 if($fingerprint1 == $fingerprint2) { pass(); } else { fail([$fingerprint1, $fingerprint2]); };458 ?>459 </td>460 </tr> 461 <tr>462 <td>API row_group row order does matter</td>463 <td>464 <?php465 $schema = "CREATE TABLE test";466 $content1 = array("a" => "b", "c" => "d");467 $content2 = array("c" => "d", "a" => "b");468 $row1 = array( "content" => $content1, "schema" => $schema);469 $row2 = array( "content" => $content2, "schema" => $schema);470 $row_group1 = array("rows" => [$row1, $row2], "schema" => $schema);471 $row_group2 = array("rows" => [$row2, $row1], "schema" => $schema);472 $fingerprint1 = $api->fingerprint_for_row_group($row_group1);473 $fingerprint2 = $api->fingerprint_for_row_group($row_group2);474 if($fingerprint1 != $fingerprint2) { pass(); } else { fail([$fingerprint1, $fingerprint2]); };475 ?>476 </td>477 </tr> 478 <tr>479 <td>API row_group fingerprint includes schema</td>480 <td>481 <?php482 $schema = "CREATE TABLE test";483 $content1 = array("a" => "b", "c" => "d");484 $content2 = array("c" => "d", "a" => "b");485 $row1 = array( "content" => $content1, "schema" => $schema);486 $row2 = array( "content" => $content2, "schema" => $schema);487 $row_group1 = array("rows" => [$row1, $row2], "schema" => $schema);488 $row_group2 = array("rows" => [$row1, $row2], "schema" => ($schema."DIFFERENT"));489 $fingerprint1 = $api->fingerprint_for_row_group($row_group1);490 $fingerprint2 = $api->fingerprint_for_row_group($row_group2);491 if($fingerprint1 != $fingerprint2) { pass(); } else { fail([$fingerprint1, $fingerprint2]); };492 ?>493 </td>494 </tr> 495 <tr>496 <td>API upload files</td>497 <td>498 <?php499 $files = array($WP_PATH, $WP_PATH."/index.php");500 $results = $api->upload_files($files, 0, BitsUtil::fs_get_wp_config_path());501 if(502 count($results) == count($files) &&503 count($results[$WP_PATH."/index.php"]) > 0504 ) { pass(); } else { fail($results); };505 ?>506 </td>507 </tr> 508 <tr>509 <th colspan="2"> Backup State Machine </th>510 </tr>511 <tr>512 <td>Invalid State return WP_Error</td>513 <td>514 <?php515 $result = $backup_state_machine->process_step($worker, "NOT-REAL-STEP");516 if(517 is_wp_error($result)518 ) { pass(); } else { fail($result); };519 ?>520 </td>521 </tr> 522 <tr>523 <th colspan="2"> Restore State Machine </th>524 </tr>525 <tr>526 <th colspan="2"> Backup Worker </th>527 </tr>528 <tr>529 <td> Util - all_tables</td>530 <td>531 <?php532 $result = BitsUtil::all_tables();533 if(sizeof($result) > 0) { pass(); } else { fail($result); };534 ?>535 </td>536 </tr>537 <tr>538 <td>Backup Worker - query throws error</td>539 <td>540 <?php541 global $wpdb;542 $restore = create_restore($api);543 $worker = new BitsBackupWorker($api);544 $result = $worker->query("NOT VALID SQL");545 $worker->query("SELECT 1"); // Clear out database errors546 if(is_wp_error($result)) { pass(); } else { fail($result); };547 ?>548 </td>549 </tr>550 <tr>551 <td>Backup API - creates backup</td>552 <td>553 <?php554 $worker = new BitsBackupWorker($api);555 $result = create_backup($api);556 if($result["id"] > 0) { pass(); } else { fail($result);};557 ?>558 </td>559 </tr>560 <tr>561 <td>Backup Worker - upload files</td>562 <td>563 <?php564 $worker = new BitsBackupWorker($api);565 $backup_id = create_backup($api)["id"];566 $worker->upload_files($backup_id, 0, BitsUtil::fs_get_wp_config_path());567 $result = $api->get_backup($backup_id);568 if($result["file_count"] > 5569 ) { pass(); } else { fail($result); };570 ?>571 </td>572 </tr>573 <tr>574 <td>Backup Worker - scan schema</td>575 <td>576 <?php577 $worker = new BitsBackupWorker($api);578 $backup_id = create_backup($api)["id"];579 $scan_response = $worker->scan_schema($backup_id);580 if(is_wp_error($scan_response)) return fail($scan_response);581 $result = $api->get_backup($backup_id);582 if($result["schema_count"] > 0 && $result["id"] == $backup_id) { pass(); } else { fail($result); };583 ?>584 </td>585 </tr>586 <tr>587 <td>API - Force UTF8</td>588 <td>589 <?php590 $hex = hex2bin("AFAFAF");591 $expected = array(592 [null, null],593 ["test", "test"],594 [array("a" => "b"), array("a" => "b")],595 [array(1,2,3), array(1,2,3)],596 [1, 1],597 [array(array("test" => $hex)), array(array("test" => "base64:".base64_encode($hex)))],598 [$hex, "base64:".base64_encode($hex)]599 );600 foreach($expected as $test) {601 $input = $test[0];602 $output = $test[1];603 $actual = $api->force_utf_8($input);604 if($actual == $output) { pass(); } else { echo "<br/>INPUT is $input expected '$output' got '$actual'"; fail($output); };605 }606 ?>607 </tr>608 <tr>609 <td>Backup Worker - base64 encodes blobs</td>610 <td>611 <?php612 $worker = new BitsBackupWorker($api);613 $drop_sql = "DROP TABLE IF EXISTS `bitstesttable`";614 $create_sql = "615 CREATE TABLE `bitstesttable` (616 `filenameMD5` binary(16) NOT NULL,617 PRIMARY KEY (`filenameMD5`)618 ) ENGINE=InnoDB DEFAULT CHARSET=utf8619 ";620 $insert_sql = "INSERT INTO bitstesttable (filenameMD5) VALUES (UNHEX('0000000056F97205570A72A3B5807B3F'))";621 $select_sql = "SELECT * FROM bitnami_wordpress.bitstesttable";622 $drop = BitsUtil::query($drop_sql, ARRAY_N);623 $create = BitsUtil::query($create_sql, ARRAY_N);624 $insert = BitsUtil::query($insert_sql, ARRAY_N);625 $select = BitsUtil::query($select_sql, ARRAY_A);626 $base64 = bin2hex($select[0]['filenameMD5']);627 $rows = $worker->rows_for_table("bitstesttable", 0, 1000);628 $json = $api->json($rows);629 $decoded_class = $api->json_decode($json);630 $decoded = $api->recurse_translate_object_to_array($decoded_class);631 if(632 $decoded[0]["filenameMD5"] == "base64:AAAAAFb5cgVXCnKjtYB7Pw=="633 ) { pass(); } else { fail($decoded); };634 ?>635 </tr>636 <tr>637 <td>Backup Worker - scan table - handles page 0 of table 3</td>638 <td>639 <?php640 $worker = new BitsBackupWorker($api);641 $backup_id = create_backup($api)["id"];642 $worker->scan_schema($backup_id);643 $schema = 'wp_posts';644 $worker->scan_table($backup_id,$schema, 0, sha1(BitsUtil::get_schema($schema)));645 $result = $api->get_backup($backup_id);646 if(647 $result["row_group_count"] >= 1648 ) { pass(); } else { fail($result); };649 ?>650 </td>651 </tr>652 <tr>653 <td>[integration] Backup Worker - adds schema to active backup API</td>654 <td>655 <?php656 $worker = new BitsBackupWorker($api);657 $backup_id = create_backup($api)["id"];658 $worker->scan_schema($backup_id);659 $backup = $api->get_backup($backup_id);660 if($backup["schema_count"] > 0) { pass(); } else { fail($backup); };661 ?>662 </td>663 </tr>664 <tr>665 <td>[integration] Backup Worker - complete empty backup</td>666 <td>667 <?php668 $worker = new BitsBackupWorker($api);669 $backup_id = create_backup($api)["id"];670 $worker->complete($backup_id);671 $backup = $api->get_backup($backup_id);672 if($backup["state"] == "COMMITTED") { pass(); } else { fail($backup); };673 ?>674 </td>675 </tr>676 <tr>677 <th colspan="2"> Restore Worker </th>678 </tr>679 <?php680 function create_restore($api) {681 $backup = create_backup($api, array( "test" => "true" ));682 $backup_worker = new BitsBackupWorker($api);683 $backup_worker->scan_schema($backup['id']);684 $backup_worker->scan_table($backup['id'],"wp_posts", 0, sha1(BitsUtil::get_schema("wp_posts")));685 $committed = $api->commit_backup($backup["id"]);686 return $api->create_restore($backup['id']);687 }688 ?>689 <tr>690 <td>Restore Worker - create_restore can create a restore</td>691 <td>692 <?php693 $result = create_restore($api);694 if($result["id"] > 0) { pass(); } else { fail($result); };695 ?>...

Full Screen

Full Screen

backup-actions.php

Source:backup-actions.php Github

copy

Full Screen

...15 ),16 ),17 )18);19$create_backup_link = add_query_arg(20 array(21 'jet_action' => $this->get_slug(),22 'handle' => 'create_backup',23 ),24 admin_url( 'admin.php' )25);26$create_backup = sprintf(27 '<a href="%1$s" class="cx-button cx-button-normal-style">%2$s</a>',28 $create_backup_link,29 __( 'Create Backup', 'jet-theme-core' )30);31$this->builder->register_html(32 array(33 'jet_core_create_backup' => array(34 'type' => 'html',35 'class' => 'cx-control',36 'html' => $create_backup,37 ),38 )39);40$this->builder->render();...

Full Screen

Full Screen

create_backup

Using AI Code Generation

copy

Full Screen

1require_once ('backup.class.php');2$backup = new backup();3$backup->create_backup();4require_once ('backup.class.php');5$backup = new backup();6$backup->restore_backup();

Full Screen

Full Screen

create_backup

Using AI Code Generation

copy

Full Screen

1require_once('backup.php');2$backup = new backup();3$backup->create_backup('localhost','root','','database_name');4require_once('backup.php');5$backup = new backup();6$backup->restore_backup('localhost','root','','database_name','backup.sql');

Full Screen

Full Screen

create_backup

Using AI Code Generation

copy

Full Screen

1$backup = new backup();2$backup->create_backup();3$backup->restore_backup();4{5 public function create_backup()6 {7 echo "Backup created";8 }9 public function restore_backup()10 {11 echo "Backup restored";12 }13}14include('backup.php');15$backup = new backup();16$backup->create_backup();17$backup->restore_backup();

Full Screen

Full Screen

create_backup

Using AI Code Generation

copy

Full Screen

1require_once('backup.php');2$backup = new backup();3$backup->create_backup();4$backup->backup_path = 'backup/';5$backup->backup_name = 'backup.sql';6$backup->backup_database();7$backup->download_backup();

Full Screen

Full Screen

create_backup

Using AI Code Generation

copy

Full Screen

1include "backup.php";2$backup = new backup;3$backup->create_backup();4include "backup.php";5$backup = new backup;6$backup->restore_backup();7include "backup.php";8$backup = new backup;9$backup->create_backup();10$backup->restore_backup();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger create_backup code on LambdaTest Cloud Grid

Execute automation tests with create_backup on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful