<commit_before><?php
/*=========================================================================
 MIDAS Server
 Copyright (c) Kitware SAS. 26 rue <NAME>. 69100 Villeurbanne, FRANCE
 All rights reserved.
 More information http://www.kitware.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0.txt

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
=========================================================================*/

/**
 * \class ItemDao
 * \brief DAO Bitstream (table bitstream)
 */
class BitstreamDao extends AppDao
{
  public $_model = 'Bitstream';
  public $_components = array('MimeType', 'Utility');

  /** Fill the properties of the bitstream given the path.
   *  The file should be accessible from the web server.
   */
  function fillPropertiesFromPath()
    {
    // Check if the path exists
    if(!isset($this->path) || empty($this->path))
      {
      throw new Zend_Exception('BitstreamDao path is not set in fillPropertiesFromPath()');
      }

    // TODO Compute the full path from the assetstore. For now using the path
    $this->setMimetype($this->Component->MimeType->getType($this->path));
    // clear the stat cache, as the underlying file might have changed
    // since the last time filesize was called on the same filepath
    clearstatcache(true, $this->path);
    $this->setSizebytes(filesize($this->path));
    if(!isset($this->checksum) || empty($this->checksum))
      {
      $this->setChecksum(UtilityComponent::md5file($this->path));
      }
    } // end fillPropertiesFromPath()

  /** Returns the full path of the bitstream based on the assetstore and the path of the bitstream */
  function getFullPath()
    {
    $assetstore = $this->get('assetstore');
    return $assetstore->getPath().'/'.$this->getPath();
    } // end function getFullPath()


} // end class
?>
<commit_msg>BUG: refs #408. Changed clearstatcache to be compatable with php 5.2 .<commit_after><?php
/*=========================================================================
 MIDAS Server
 Copyright (c) Kitware SAS. 26 rue <NAME>. 69100 Villeurbanne, FRANCE
 All rights reserved.
 More information http://www.kitware.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0.txt

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
=========================================================================*/

/**
 * \class ItemDao
 * \brief DAO Bitstream (table bitstream)
 */
class BitstreamDao extends AppDao
{
  public $_model = 'Bitstream';
  public $_components = array('MimeType', 'Utility');

  /** Fill the properties of the bitstream given the path.
   *  The file should be accessible from the web server.
   */
  function fillPropertiesFromPath()
    {
    // Check if the path exists
    if(!isset($this->path) || empty($this->path))
      {
      throw new Zend_Exception('BitstreamDao path is not set in fillPropertiesFromPath()');
      }

    // TODO Compute the full path from the assetstore. For now using the path
    $this->setMimetype($this->Component->MimeType->getType($this->path));
    // clear the stat cache, as the underlying file might have changed
    // since the last time filesize was called on the same filepath
    clearstatcache();
    $this->setSizebytes(filesize($this->path));
    if(!isset($this->checksum) || empty($this->checksum))
      {
      $this->setChecksum(UtilityComponent::md5file($this->path));
      }
    } // end fillPropertiesFromPath()

  /** Returns the full path of the bitstream based on the assetstore and the path of the bitstream */
  function getFullPath()
    {
    $assetstore = $this->get('assetstore');
    return $assetstore->getPath().'/'.$this->getPath();
    } // end function getFullPath()


} // end class
?>

{'fraction_non_alphanumeric': 0.16637516397026672, 'fraction_numerical': 0.006340183646698732, 'mean_word_length': 3.780564263322884, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7464566', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1180, 'n_words': 456}