SAAS-596: Store file size and hash in database
Updated schema and added filesize and md5_hash columns. Changed getFileSize functions to return the value stored in the database. Removed getFileSize from the cloud storage classes.
This commit is contained in:
parent
a1436bfebb
commit
6ccc634782
12 changed files with 238 additions and 53 deletions
|
@ -463,6 +463,20 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $is_playlist;
|
||||
|
||||
/**
|
||||
* The value for the filesize field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $filesize;
|
||||
|
||||
/**
|
||||
* The value for the md5_hash field.
|
||||
* Note: this column has a database default value of: ''
|
||||
* @var string
|
||||
*/
|
||||
protected $md5_hash;
|
||||
|
||||
/**
|
||||
* @var CcSubjs
|
||||
*/
|
||||
|
@ -592,6 +606,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->hidden = false;
|
||||
$this->is_scheduled = false;
|
||||
$this->is_playlist = false;
|
||||
$this->filesize = 0;
|
||||
$this->md5_hash = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1470,6 +1486,28 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this->is_playlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [filesize] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbFilesize()
|
||||
{
|
||||
|
||||
return $this->filesize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [md5_hash] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbMd5Hash()
|
||||
{
|
||||
|
||||
return $this->md5_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
|
@ -3000,6 +3038,48 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbIsPlaylist()
|
||||
|
||||
/**
|
||||
* Set the value of [filesize] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcFiles The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbFilesize($v)
|
||||
{
|
||||
if ($v !== null && is_numeric($v)) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->filesize !== $v) {
|
||||
$this->filesize = $v;
|
||||
$this->modifiedColumns[] = CcFilesPeer::FILESIZE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDbFilesize()
|
||||
|
||||
/**
|
||||
* Set the value of [md5_hash] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcFiles The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbMd5Hash($v)
|
||||
{
|
||||
if ($v !== null && is_numeric($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->md5_hash !== $v) {
|
||||
$this->md5_hash = $v;
|
||||
$this->modifiedColumns[] = CcFilesPeer::MD5_HASH;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDbMd5Hash()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
|
@ -3066,6 +3146,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->filesize !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->md5_hash !== '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return true
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
|
@ -3158,6 +3246,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->hidden = ($row[$startcol + 67] !== null) ? (boolean) $row[$startcol + 67] : null;
|
||||
$this->is_scheduled = ($row[$startcol + 68] !== null) ? (boolean) $row[$startcol + 68] : null;
|
||||
$this->is_playlist = ($row[$startcol + 69] !== null) ? (boolean) $row[$startcol + 69] : null;
|
||||
$this->filesize = ($row[$startcol + 70] !== null) ? (int) $row[$startcol + 70] : null;
|
||||
$this->md5_hash = ($row[$startcol + 71] !== null) ? (string) $row[$startcol + 71] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -3167,7 +3257,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
$this->postHydrate($row, $startcol, $rehydrate);
|
||||
|
||||
return $startcol + 70; // 70 = CcFilesPeer::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 72; // 72 = CcFilesPeer::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcFiles object", $e);
|
||||
|
@ -3751,6 +3841,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) {
|
||||
$modifiedColumns[':p' . $index++] = '"is_playlist"';
|
||||
}
|
||||
if ($this->isColumnModified(CcFilesPeer::FILESIZE)) {
|
||||
$modifiedColumns[':p' . $index++] = '"filesize"';
|
||||
}
|
||||
if ($this->isColumnModified(CcFilesPeer::MD5_HASH)) {
|
||||
$modifiedColumns[':p' . $index++] = '"md5_hash"';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'INSERT INTO "cc_files" (%s) VALUES (%s)',
|
||||
|
@ -3972,6 +4068,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case '"is_playlist"':
|
||||
$stmt->bindValue($identifier, $this->is_playlist, PDO::PARAM_BOOL);
|
||||
break;
|
||||
case '"filesize"':
|
||||
$stmt->bindValue($identifier, $this->filesize, PDO::PARAM_INT);
|
||||
break;
|
||||
case '"md5_hash"':
|
||||
$stmt->bindValue($identifier, $this->md5_hash, PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
|
@ -4381,6 +4483,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case 69:
|
||||
return $this->getDbIsPlaylist();
|
||||
break;
|
||||
case 70:
|
||||
return $this->getDbFilesize();
|
||||
break;
|
||||
case 71:
|
||||
return $this->getDbMd5Hash();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
|
@ -4480,6 +4588,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$keys[67] => $this->getDbHidden(),
|
||||
$keys[68] => $this->getDbIsScheduled(),
|
||||
$keys[69] => $this->getDbIsPlaylist(),
|
||||
$keys[70] => $this->getDbFilesize(),
|
||||
$keys[71] => $this->getDbMd5Hash(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
|
@ -4758,6 +4868,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
case 69:
|
||||
$this->setDbIsPlaylist($value);
|
||||
break;
|
||||
case 70:
|
||||
$this->setDbFilesize($value);
|
||||
break;
|
||||
case 71:
|
||||
$this->setDbMd5Hash($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
|
@ -4852,6 +4968,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[67], $arr)) $this->setDbHidden($arr[$keys[67]]);
|
||||
if (array_key_exists($keys[68], $arr)) $this->setDbIsScheduled($arr[$keys[68]]);
|
||||
if (array_key_exists($keys[69], $arr)) $this->setDbIsPlaylist($arr[$keys[69]]);
|
||||
if (array_key_exists($keys[70], $arr)) $this->setDbFilesize($arr[$keys[70]]);
|
||||
if (array_key_exists($keys[71], $arr)) $this->setDbMd5Hash($arr[$keys[71]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4933,6 +5051,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcFilesPeer::HIDDEN)) $criteria->add(CcFilesPeer::HIDDEN, $this->hidden);
|
||||
if ($this->isColumnModified(CcFilesPeer::IS_SCHEDULED)) $criteria->add(CcFilesPeer::IS_SCHEDULED, $this->is_scheduled);
|
||||
if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) $criteria->add(CcFilesPeer::IS_PLAYLIST, $this->is_playlist);
|
||||
if ($this->isColumnModified(CcFilesPeer::FILESIZE)) $criteria->add(CcFilesPeer::FILESIZE, $this->filesize);
|
||||
if ($this->isColumnModified(CcFilesPeer::MD5_HASH)) $criteria->add(CcFilesPeer::MD5_HASH, $this->md5_hash);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
@ -5065,6 +5185,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$copyObj->setDbHidden($this->getDbHidden());
|
||||
$copyObj->setDbIsScheduled($this->getDbIsScheduled());
|
||||
$copyObj->setDbIsPlaylist($this->getDbIsPlaylist());
|
||||
$copyObj->setDbFilesize($this->getDbFilesize());
|
||||
$copyObj->setDbMd5Hash($this->getDbMd5Hash());
|
||||
|
||||
if ($deepCopy && !$this->startCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
|
@ -6971,6 +7093,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->hidden = null;
|
||||
$this->is_scheduled = null;
|
||||
$this->is_playlist = null;
|
||||
$this->filesize = null;
|
||||
$this->md5_hash = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
$this->alreadyInClearAllReferencesDeep = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue