This file is indexed.

/usr/share/phoronix-test-suite/pts-core/objects/pts_storage_object.php is in phoronix-test-suite 4.8.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php

/*
	Phoronix Test Suite
	URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
	Copyright (C) 2009 - 2011, Phoronix Media
	Copyright (C) 2009 - 2011, Michael Larabel
	pts_storage_object.php: An object for storing other PTS objects on the disk

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

class pts_storage_object
{
	private $object_cache;
	private $object_cs;
	private $creation_time;
	private $span_reboots;
	private $span_versions;
	private $pts_version;

	public function __construct($span_reboots = true, $span_versions = true)
	{
		$this->creation_time = time();
		$this->span_reboots = $span_reboots;
		$this->span_versions = $span_versions;
		$this->pts_version = PTS_CORE_VERSION;
		$this->object_cache = array();
	}
	public function add_object($identifier, $object)
	{
		$this->object_cache[$identifier] = $object;
	}
	public function read_object($identifier)
	{
		return isset($this->object_cache[$identifier]) ? $this->object_cache[$identifier] : false;
	}
	public function remove_object($identifier)
	{
		unset($this->object_cache[$identifier]);
	}
	public function get_objects()
	{
		return $this->object_cache;
	}
	public function save_to_file($destination)
	{
		$this->object_cs = md5(serialize($this->get_objects())); // Checksum
		$string_version = base64_encode(serialize($this));
		file_put_contents($destination, wordwrap($string_version, 80, PHP_EOL, true));
	}
	public function get_pts_version()
	{
		return $this->pts_version;
	}
	public function get_object_checksum()
	{
		return $this->object_cs;
	}
	public function get_span_reboots()
	{
		return $this->span_reboots;
	}
	public function get_span_versions()
	{
		return $this->span_versions !== false;
	}
	public function get_creation_time()
	{
		return $this->creation_time;
	}
	public function force_recover_from_file($read_from_file)
	{
		$restore_obj = false;

		if(is_file($read_from_file))
		{
			$restore = unserialize(base64_decode(file_get_contents($read_from_file)));

			if($restore instanceof pts_storage_object)
			{
				$restore_obj = $restore;
			}
		}

		return $restore_obj;
	}
	public static function recover_from_file($read_from_file)
	{
		$restore_obj = false;

		if(is_file($read_from_file))
		{
			$restore = unserialize(base64_decode(file_get_contents($read_from_file)));

			if($restore instanceof pts_storage_object)
			{
				if(($restore->get_span_versions() || $restore->get_pts_version() == PTS_CORE_VERSION) && md5(serialize($restore->get_objects())) == $restore->get_object_checksum())
				{
					if($restore->get_span_reboots() == false)
					{
						$continue_loading = $restore->get_creation_time() > (time() - phodevi::system_uptime());
					}
					else
					{
						$continue_loading = true;
					}

					if($continue_loading)
					{
						$restore_obj = $restore;
					}
				}
			}
		}

		return $restore_obj;
	}
	public static function set_in_file($storage_file, $identifier, $object)
	{
		$storage = self::recover_from_file($storage_file);

		if($storage != false)
		{
			$storage->add_object($identifier, $object);
			$storage->save_to_file($storage_file);
		}
	}
	public static function remove_in_file($storage_file, $identifier)
	{
		$storage = self::recover_from_file($storage_file);

		if($storage != false)
		{
			$storage->remove_object($identifier);
			$storage->save_to_file($storage_file);
		}
	}
	public static function add_in_file($storage_file, $identifier, $add)
	{
		$storage = self::recover_from_file($storage_file);

		if($storage != false)
		{
			$current_value = $storage->read_object($identifier);
			$current_value = is_numeric($current_value) ? $current_value : 0;

			$storage->add_object($identifier, $current_value + $add);
			$storage->save_to_file($storage_file);
		}
	}
	public static function read_from_file($storage_file, $identifier)
	{
		$storage = self::recover_from_file($storage_file);
		$object = false;

		if($storage != false)
		{
			$object = $storage->read_object($identifier);
		}

		return $object;
	}
}

?>