blob: de187ac62dc72e5403c889d2961e6089dd003bc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id: Record.php 180 2008-01-17 16:32:37Z matt $
*
* @package Piwik_ArchiveProcessing
*/
/**
* Array of blob records.
* Useful for easily saving splited data in the DB.
*
* Example: $record = new Piwik_ArchiveProcessing_Record_BlobArray(
* 'veryLongBook',
* 0 => serialize( array( '1st chapter very long, 6MB of data we dont want to save' )),
* 1 => serialize( array( '2nd chapter very long, 8MB of data we dont want to save' )),
* 2 => serialize( array( '3rd chapter very long, 7MB of data we dont want to save' )),
* 3 => serialize( array( '4th chapter very long, 10MB of data we dont want to save' )),
* );
*
* Will be saved in the DB as
* veryLongBook => X
* veryLongBook_1 => Y
* veryLongBook_2 => Z
* veryLongBook_3 => M
*
* @package Piwik_ArchiveProcessing
* @subpackage Piwik_ArchiveProcessing_Record
*/
class Piwik_ArchiveProcessing_Record_BlobArray extends Piwik_ArchiveProcessing_Record
{
function __construct( $name, $aValue)
{
foreach($aValue as $id => $value)
{
// for the parent Table we keep the name
// for example for the Table of searchEngines we keep the name 'referer_search_engine'
// but for the child table of 'Google' which has the ID = 9 the name would be 'referer_search_engine_9'
if($id == 0)
{
$newName = $name;
}
else
{
$newName = $name . '_' . $id;
}
$record = new Piwik_ArchiveProcessing_Record_Blob( $newName, $value );
}
}
public function __toString()
{
throw new Exception( 'Not valid' );
}
public function delete()
{
throw new Exception( 'Not valid' );
}
}
|