CMS  Version 3.9
import.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("component");
3 
4 global $config;
5 
6 $menu_item = "Import Configuration";
7 $title = "Select Site Content to be Imported";
8 
9 $form = new SerializationForm("Import");
10 
11 $script .= $form->writeScript();
12 
13 if ($method == "POST")
14 {
15  $components = $form->getSelected();
16  trace("*** Importing $components", 3);
17 
18  $tmp = $_FILES["import_file"]["tmp_name"];
19  $base = basename($_FILES["import_file"]["name"]);
20  $file = $config["uploadbase"].DIRECTORY_SEPARATOR.$base;
21 
22  move_uploaded_file($tmp, $file);
23 
24  $fs = filesize($file);
25  trace("Import File Path: $file", 3);
26  trace("Import File Size: $fs bytes", 3);
27 
28  if ($fs > 10 * 1024 * 1024)
29  {
30  trace("Large Import File detected - launching background process", 3 );
31  $_SESSION["xml_import_file_path"] = $file;
32  $_SESSION["xml_import_components"] = $components;
33  redirect("/admin/import_background");
34  }
35 
36  $xml = file_get_contents($file);
37 
38  $form->mgr->import($xml, $components);
39 
40  unlink($file);
41  redirect("index");
42 }
43 
44 $form->drawForm();
45 ?>
$components
Definition: tree.inc:41
$file
Definition: delete.inc:47
$base
Definition: delete.inc:45
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
SerializationForm implements the custom form used in the Fakoli admin section import and export pages...
$method
Pull out a simple reference to the request method.
Definition: core.inc:1573
$form
Definition: import.inc:9
global $config
Definition: import.inc:4
$menu_item
Definition: import.inc:6
$title
Definition: import.inc:7
$script
Definition: import.inc:11
$_SESSION["useMobile"]
Definition: override.inc:7