mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-01-23 02:35:23 +00:00
remove more v1 legacy
- document removed unused columns in database schema of tables `paste` & `comment` - amended misleading comments - nickname is part of the encrypted payload in v2 comments and therefore there is nothing to store separately
This commit is contained in:
parent
e2859e9a35
commit
b79ae4e929
5 changed files with 11 additions and 15 deletions
|
|
@ -6,6 +6,7 @@
|
|||
* CHANGED: Removed support for ZeroBin & v1 pastes - since release 1.3 the v2 format is used (#551)
|
||||
* CHANGED: Removed use of base64 & rawinflate libraries (#551)
|
||||
* CHANGED: Removed support for `privatebin_data`, `privatebin_db` & `zerobin_db` model class configurations, must be replaced with `Filesystem` or `Database` in `cfg/conf.php`, if still present
|
||||
* CHANGED: Removed unused columns in database schema of tables `paste` & `comment`
|
||||
* FIXED: Name mismatches in attached files (#1584)
|
||||
* FIXED: Unable to paste attachments from clipboard (#1589)
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@ CREATE TABLE prefix_comment (
|
|||
pasteid CHAR(16),
|
||||
parentid CHAR(16),
|
||||
data BLOB,
|
||||
nickname BLOB,
|
||||
vizhash BLOB,
|
||||
postdate INT,
|
||||
PRIMARY KEY (dataid)
|
||||
|
|
|
|||
|
|
@ -256,22 +256,18 @@ class Database extends AbstractData
|
|||
return false;
|
||||
}
|
||||
$meta = $comment['meta'];
|
||||
unset($comment['meta']);
|
||||
foreach (array('nickname', 'icon') as $key) {
|
||||
if (!array_key_exists($key, $meta)) {
|
||||
$meta[$key] = null;
|
||||
}
|
||||
if (!array_key_exists('icon', $meta)) {
|
||||
$meta['icon'] = null;
|
||||
}
|
||||
try {
|
||||
return $this->_exec(
|
||||
'INSERT INTO "' . $this->_sanitizeIdentifier('comment') .
|
||||
'" VALUES(?,?,?,?,?,?,?)',
|
||||
'" VALUES(?,?,?,?,?,?)',
|
||||
array(
|
||||
$commentid,
|
||||
$pasteid,
|
||||
$parentid,
|
||||
$data,
|
||||
$meta['nickname'],
|
||||
$meta['icon'],
|
||||
$meta['created'],
|
||||
)
|
||||
|
|
@ -304,10 +300,8 @@ class Database extends AbstractData
|
|||
$comments[$i]['id'] = $row['dataid'];
|
||||
$comments[$i]['parentid'] = $row['parentid'];
|
||||
$comments[$i]['meta'] = array('created' => (int) $row['postdate']);
|
||||
foreach (array('nickname' => 'nickname', 'vizhash' => 'icon') as $rowKey => $commentKey) {
|
||||
if (array_key_exists($rowKey, $row) && !empty($row[$rowKey])) {
|
||||
$comments[$i]['meta'][$commentKey] = $row[$rowKey];
|
||||
}
|
||||
if (array_key_exists('vizhash', $row) && !empty($row['vizhash'])) {
|
||||
$comments[$i]['meta']['icon'] = $row['vizhash'];
|
||||
}
|
||||
}
|
||||
ksort($comments);
|
||||
|
|
@ -677,7 +671,6 @@ class Database extends AbstractData
|
|||
'"pasteid" CHAR(16), ' .
|
||||
'"parentid" CHAR(16), ' .
|
||||
"\"data\" $dataType, " .
|
||||
"\"nickname\" $dataType, " .
|
||||
"\"vizhash\" $dataType, " .
|
||||
"\"postdate\" INT$after_key )"
|
||||
);
|
||||
|
|
@ -872,6 +865,10 @@ class Database extends AbstractData
|
|||
'ALTER TABLE "' . $this->_sanitizeIdentifier('paste') .
|
||||
'" DROP COLUMN "attachmentname"'
|
||||
);
|
||||
$this->_db->exec(
|
||||
'ALTER TABLE "' . $this->_sanitizeIdentifier('comment') .
|
||||
'" DROP COLUMN "nickname"'
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->_exec(
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ class DatabaseTest extends TestCase
|
|||
|
||||
public function testDatabaseBasedAttachmentStoreWorks()
|
||||
{
|
||||
// this assumes a version 1 formatted paste
|
||||
$this->_model->delete(Helper::getPasteId());
|
||||
$original = $paste = Helper::getPaste(array('expire_date' => 1344803344));
|
||||
$paste['meta']['burnafterreading'] = $original['meta']['burnafterreading'] = true;
|
||||
|
|
|
|||
|
|
@ -485,6 +485,6 @@ class ModelTest extends TestCase
|
|||
$vz = new Vizhash16x16();
|
||||
$pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash()));
|
||||
$comment = current($this->_model->getPaste(Helper::getPasteId())->get()['comments']);
|
||||
$this->assertEquals($pngdata, $comment['meta']['icon'], 'nickname triggers vizhash to be set');
|
||||
$this->assertEquals($pngdata, $comment['meta']['icon'], 'vizhash was generated');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue