Explorar el Código

inicio de la lectura de los nodos con esquemas

Christian hace 3 años
padre
commit
dd1922962b

+ 96 - 0
application/config/111database.php Ver fichero

@@ -0,0 +1,96 @@
1
+<?php
2
+defined('BASEPATH') OR exit('No direct script access allowed');
3
+
4
+/*
5
+| -------------------------------------------------------------------
6
+| DATABASE CONNECTIVITY SETTINGS
7
+| -------------------------------------------------------------------
8
+| This file will contain the settings needed to access your database.
9
+|
10
+| For complete instructions please consult the 'Database Connection'
11
+| page of the User Guide.
12
+|
13
+| -------------------------------------------------------------------
14
+| EXPLANATION OF VARIABLES
15
+| -------------------------------------------------------------------
16
+|
17
+|	['dsn']      The full DSN string describe a connection to the database.
18
+|	['hostname'] The hostname of your database server.
19
+|	['username'] The username used to connect to the database
20
+|	['password'] The password used to connect to the database
21
+|	['database'] The name of the database you want to connect to
22
+|	['dbdriver'] The database driver. e.g.: mysqli.
23
+|			Currently supported:
24
+|				 cubrid, ibase, mssql, mysql, mysqli, oci8,
25
+|				 odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
26
+|	['dbprefix'] You can add an optional prefix, which will be added
27
+|				 to the table name when using the  Query Builder class
28
+|	['pconnect'] TRUE/FALSE - Whether to use a persistent connection
29
+|	['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
30
+|	['cache_on'] TRUE/FALSE - Enables/disables query caching
31
+|	['cachedir'] The path to the folder where cache files should be stored
32
+|	['char_set'] The character set used in communicating with the database
33
+|	['dbcollat'] The character collation used in communicating with the database
34
+|				 NOTE: For MySQL and MySQLi databases, this setting is only used
35
+| 				 as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
36
+|				 (and in table creation queries made with DB Forge).
37
+| 				 There is an incompatibility in PHP with mysql_real_escape_string() which
38
+| 				 can make your site vulnerable to SQL injection if you are using a
39
+| 				 multi-byte character set and are running versions lower than these.
40
+| 				 Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
41
+|	['swap_pre'] A default table prefix that should be swapped with the dbprefix
42
+|	['encrypt']  Whether or not to use an encrypted connection.
43
+|
44
+|			'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
45
+|			'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
46
+|
47
+|				'ssl_key'    - Path to the private key file
48
+|				'ssl_cert'   - Path to the public key certificate file
49
+|				'ssl_ca'     - Path to the certificate authority file
50
+|				'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
51
+|				'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
52
+|				'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
53
+|
54
+|	['compress'] Whether or not to use client compression (MySQL only)
55
+|	['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
56
+|							- good for ensuring strict SQL while developing
57
+|	['ssl_options']	Used to set various SSL options that can be used when making SSL connections.
58
+|	['failover'] array - A array with 0 or more data for connections if the main should fail.
59
+|	['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
60
+| 				NOTE: Disabling this will also effectively disable both
61
+| 				$this->db->last_query() and profiling of DB queries.
62
+| 				When you run a query, with this setting set to TRUE (default),
63
+| 				CodeIgniter will store the SQL statement for debugging purposes.
64
+| 				However, this may cause high memory usage, especially if you run
65
+| 				a lot of SQL queries ... disable this to avoid that problem.
66
+|
67
+| The $active_group variable lets you choose which connection group to
68
+| make active.  By default there is only one group (the 'default' group).
69
+|
70
+| The $query_builder variables lets you determine whether or not to load
71
+| the query builder class.
72
+*/
73
+$active_group = 'default';
74
+$query_builder = TRUE;
75
+
76
+$db['default'] = array(
77
+	'dsn'	=> '',
78
+	'hostname' => 'localhost',
79
+	'username' => '',
80
+	'password' => '',
81
+	'database' => '',
82
+	'dbdriver' => 'mysqli',
83
+	'dbprefix' => '',
84
+	'pconnect' => FALSE,
85
+	'db_debug' => (ENVIRONMENT !== 'production'),
86
+	'cache_on' => FALSE,
87
+	'cachedir' => '',
88
+	'char_set' => 'utf8',
89
+	'dbcollat' => 'utf8_general_ci',
90
+	'swap_pre' => '',
91
+	'encrypt' => FALSE,
92
+	'compress' => FALSE,
93
+	'stricton' => FALSE,
94
+	'failover' => array(),
95
+	'save_queries' => TRUE
96
+);

+ 98 - 0
application/controllers/FileDownload.php Ver fichero

@@ -0,0 +1,98 @@
1
+<?php
2
+defined('BASEPATH') or exit('No direct script access allowed');
3
+
4
+class FileDownload extends CI_Controller
5
+{
6
+
7
+    protected $rutaDiaria = FCPATH . "DOWNLOADS/DAILY/";
8
+    protected $rutaMensual = FCPATH . "DOWNLOADS/MONTH/";
9
+    protected $enlaceAtom = "";
10
+
11
+    public function __construct()
12
+    {
13
+        parent::__construct();
14
+        $this->load->library('Feed');
15
+        $this->load->helper('file');
16
+        $this->load->helper('xml');
17
+
18
+    }
19
+
20
+    public function index()
21
+    {
22
+        $files = get_filenames($this->rutaDiaria, true);
23
+
24
+        foreach ($files as $file) {
25
+            $entrada = file_get_contents($file);
26
+            $xml = new SimpleXMLElement($entrada);
27
+            $deletedEntrys = $xml->children('at', true);
28
+            $result1 = $xml->entry->children('cac-place-ext', true);
29
+            $result2 = $xml->entry->children('cac-place-ext', true)->ContractFolderStatus->children('cac-place-ext', true);
30
+            $result3 = $xml->entry->children('cac-place-ext', true)->ContractFolderStatus->children('cac', true);
31
+            $result4 = $xml->entry->children('cac-place-ext', true)->ContractFolderStatus->children('cbc', true);
32
+        }
33
+    }
34
+
35
+    private function downloadProcess()
36
+    {
37
+        $fileName = basename(URL_DIARIA);
38
+        $this->downloadFile($fileName, URL_DIARIA, $this->rutaDiaria);
39
+
40
+        $archivoAtom = $this->getFile($this->rutaDiaria . $fileName);
41
+        $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
42
+
43
+        while ($nuevoAtomAttrNext !== "") {
44
+
45
+            $fileName = basename($nuevoAtomAttrNext);
46
+            $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiaria);
47
+            $archivoAtom = $this->getFile($this->rutaDiaria . $fileName);
48
+
49
+            $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
50
+        }
51
+    }
52
+
53
+    private function getFile($url = URL_DIARIA)
54
+    {
55
+
56
+        $feed = implode(file($url));
57
+        $xml = simplexml_load_string($feed);
58
+        $json = json_encode($xml);
59
+        $array = json_decode($json, true);
60
+
61
+        return $array;
62
+    }
63
+
64
+    private function readNextAttribute($archivo)
65
+    {
66
+        $enlace = "";
67
+        foreach ($archivo['link'] as $row) {
68
+            $attrNext = $row['@attributes']['rel'];
69
+            $attrHref = $row['@attributes']['href'];
70
+
71
+            if ($attrNext === "next") {
72
+                $enlace = $attrHref;
73
+            }
74
+        }
75
+
76
+        return $enlace;
77
+    }
78
+
79
+    private function newFolder($rutaFinal)
80
+    {
81
+        $result = false;
82
+        if (!is_dir($rutaFinal)) {
83
+            $result = mkdir($rutaFinal);
84
+        }
85
+
86
+        return $result;
87
+    }
88
+
89
+    private function downloadFile($fileName, $url, $ruta)
90
+    {
91
+        if (file_put_contents($ruta . $fileName, file_get_contents($url))) {
92
+            return true;
93
+        } else {
94
+            return false;
95
+        }
96
+    }
97
+
98
+}

+ 0 - 25
application/controllers/Welcome.php Ver fichero

@@ -1,25 +0,0 @@
1
-<?php
2
-defined('BASEPATH') OR exit('No direct script access allowed');
3
-
4
-class Welcome extends CI_Controller {
5
-
6
-	/**
7
-	 * Index Page for this controller.
8
-	 *
9
-	 * Maps to the following URL
10
-	 * 		http://example.com/index.php/welcome
11
-	 *	- or -
12
-	 * 		http://example.com/index.php/welcome/index
13
-	 *	- or -
14
-	 * Since this controller is set as the default controller in
15
-	 * config/routes.php, it's displayed at http://example.com/
16
-	 *
17
-	 * So any other public methods not prefixed with an underscore will
18
-	 * map to /index.php/welcome/<method_name>
19
-	 * @see https://codeigniter.com/user_guide/general/urls.html
20
-	 */
21
-	public function index()
22
-	{
23
-		$this->load->view('welcome_message');
24
-	}
25
-}

+ 0 - 11
application/controllers/index.html Ver fichero

@@ -1,11 +0,0 @@
1
-<!DOCTYPE html>
2
-<html>
3
-<head>
4
-	<title>403 Forbidden</title>
5
-</head>
6
-<body>
7
-
8
-<p>Directory access is forbidden.</p>
9
-
10
-</body>
11
-</html>