Drupal 7 + Failed to create directory "public://print_pdf/print_pdf_tcpdf/cache" for print_pdf_tcpdf - drupal-7

Drupal 7 + Failed to create directory
public://print_pdf/print_pdf_tcpdf/cache
for print_pdf_tcpdf with S3fs module, when we replace "public://" folder to "s3fs-public://" on s3fs module setting page.
This setting directly upload the files to s3 public directory.
Module: print module

Check the location and permissions for your files directory as specified by the Drupal 7 docs -see link below. Also, you can check the status from the performance section /admin/config..........
https://www.drupal.org/docs/7/install/setting-up-the-files-directory

Related

Get build agent folder path in tfs build

How to access TFS build agent folder path in using batchfile?
I am calling runscript tool from build workflow (calling windows batchfile).
I tried to use the environment variable BUILD_REPOSITORY_LOCALPATH ($(BUILD_REPOSITORY_LOCALPATH), $env:BUILD_REPOSITORY_LOCALPATH) but they dint give any result.
Need some assistance on this.
I used another workaround for this instead of getting by workspace. From sourceDirectory folder i drill down to find my solution project file, the path containing my solution project is the local directory path i need
From batchfile i call my exe and pass %TF_BUILD_SOURCESDIRECTORY% as parameter.
string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory)
// targetdirectory would be the input parameter from batch file`
for (int i = 0; i < subdirectoryEntries.Length ; i++)
{
// My root folder always contains a specific folder with name MyFolder
// and a file Myfile.sln
if (subdirectoryEntries[i].ToString().ToLower().Contains(#"MyFolder"))
{
Console.Writeline("My source code path is " + targetDirectory);
}
//Similarly I check for Myfile.sln and then get my path.
}
This may be a very crude way, this worked for me.
The variable you are looking for is TF_BUILD_SOURCESDIRECTORY. Please refer to the XAML build documentation.
TF_BUILD_SOURCESDIRECTORY: The sources sub-directory of the build agent working directory. This directory contains your source code. For example: C:\Build\BuildBot3\CoolApp\CIBuild\src.
If you want to get C:\TFS_Build\src\V9, it's just local path: the path that you have mapped the server path to on your machine. There is not any built-in TF_BUILD environment variables could achieve your requirement.
You could use TFS API to get the related info, first get the workspace information for the build server's workspace, then do the get option, a sample code for your reference:
// Get the workspace information for the build server's workspace
var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(sourcesDirectory);
// Get the TFS Team Project Collection information from the workspace cache
// information then load the TFS workspace itself.
var server = new TfsTeamProjectCollection(workspaceInfo.serverUri);
var workspace = workspaceInfo.GetWorkspace(server);
Once you have a workspace, you can query it for the path mappings. It
will do the necessary translation from server to local path based on
your workspace mappings. For example:
workspace.GetServerItemForLocalItem("C:\TFS_Build\src\V9");
and
workspace.GetLocalItemForServerItem("$/DEV/V9");
This mechanism will only work, however, if your build definition
actually sets up the workspace to include these files.
More details please refer this similar question: How do I resolve the root and relative paths of TFS folders on the server?
update from OP:
From sourceDirectory folder i drill down to find my solution project
file, the path containing my solution project is the local directory
path i need

Drush ARD returning Some site subdirectories are not valid Drupal sites:

I have a drupal 7 site that I am trying to migrate to Pantheon. I have done this in the past by using the drush ard command to archive the site. I am trying to do this now and I am getting an error. It does create an archive file, but the file does not include any themes or custom modules. The command I am running is
drush ard --destination "./archive.tar.gz"
and the error I get is
Some site subdirectories are not valid Drupal sites: ./archive.tar.gz
[warning] Archive saved to C:\Users\sarah\Desktop\GrabABag/1
[ok] C:\Users\sarah\Desktop\GrabABag/1
It creates a file named 1 and if I use that in the migration it shows some content, but no theme and nothing from my custom modules. Any help would be appreciated!
The right command is:
drush ard --destination=./archive.tar.gz

Deploying cakePHP project

How to configure the value of:
CAKE_CORE_INCLUDE_PATH
assuming that my hosting domain is www.example.com
I have made it like:
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS . 'usr' . DS . 'lib');
}
but it's not working and gives me error of:
Warning: include(/usr/lib/Cake/bootstrap.php): failed to open stream: No such file or directory
As #AD7six suggests, you shouldn't need to modify this constant. You need to make sure that the lib directory is deployed along with your app directory. If you would like to relocate the lib directory to somewhere else if you're going to have multiple applications, you need to add the path to the include_path in your php.ini file (see Documentation).
In theory you should be able to deploy your application in its entirety straight to your web server and just point your domain mapping to the index.php in the root of the CakePHP directory (where app and lib sit).

Meteor Server-Only Files and Temporary Downloads

In Meteor, are there any folders where I can put a .zip which will not be sent to the client?
Secondary question: how can I make temporary download links on the app, which self-destruct after a period of time?
The idea is that only the server will have access to this file. /server doesn't seem to work because any files I place in there that are not code are not included in the final bundle.
My Solution - Heroku Filesystem
This is probably not the best solution to this problem - however, to anyone else that needs to have files bundled with the app which cannot be seen by the client, here's how I did it.
Note that deleting the secure files is done because Heroku does not persist filesystem changes on restart.
Place files in a folder named "securefiles" or similar in your /public folder.
These get compiled to a folder named /static in the bundle. Note that if you're using the Heroku buildpack, the actual path to the working directory for the server is /app/.meteor/heroku_build/app/.
Next, on server start, detect if the app is bundled or not. You can do this by checking for the existence of the static folder, and there's probably other files unique to a bundle as well.
If you're bundled, copy the files out of public using ncp. I've made a meteorite package just for this purpose, use mrt add ncp to add the node copy tool to your project. I recommend copying to the root directory of the app, as this is not visible to clients.
Next, delete the folder from static.
At this point you have files which can only be accessed by the server. Here's some sample coffeescript to do this:
Meteor.startup ->
fs = __meteor_bootstrap__.require 'fs'
bundled = fs.existsSync '/app' #Checking /app because on heroku app is stored in root / app
rootDir = if bundled then "/app/.meteor/heroku_build/app/" else "" #Not sure how to get the path to the root directory on a local build, this is a bug
if fs.existsSync rootDir+"securefiles"
rmDir rootDir+"securefiles"
#Do the same with any other temporary folders you want to get rid of on startup
#now copy out the secure files
ncp rootDor+'static/securefiles', rootDir+'securefiles', ()->
rmdir rootDir+'static/securefiles' if bundled
Secure/Temporary File Downloads
Note this code has dependencies on the random package and my package ncp
It's very easy to add on to this system to support temporary file downloads, as I have done in my project. Here's how, run url = setupDownload("somefile.rar", 30) to create a temporary file download link.
setupDownload = (dlname, timeout) ->
if !timeout?
timeout = 30
file = rootDir+'securefiles/'+dlname
return '' if !fs.existsSync file
dlFolder = rootDir+'static/dls'
fs.mkdirSync dlFolder if !fs.existsSync dlFolder
dlName = Random.id()+'.rar' #Possible improvement: detect file extension
dlPath = dlFolder+'/'+dlName
ncp file, dlPath, () ->
Fiber(()->
Meteor.setTimeout(() ->
fs.unlink dlPath
, 1000*timeout)
).run()
"/dls/"+dlName
Perhaps I will make a package for this. Let me know if you could use something like that.

CakePHP Shell issue

I am just getting started with Cakephp shell and running into issues.
My cake core library is under path d:/libs/cake
My app is setup under d:/servers/htdocs/myapp
I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells
class ReportShell extends Shell {
var $uses = array('Appt');
function main() {
echo $this->Appt->find('first');
}
}
When I try to run this code from d:/servers/htdocs/myapp , It gives me an error
Warning: include_once(d:/servers/htdocs/myapp/config/database.php): failed to open stream: No such file or directory in d:/libs/cake\libs\mode
l\connection_manager.php on line 23
Warning: include_once(): Failed opening 'd:/servers/htdocs/myapp/config/database.php' for inclusion (include_path='.;D:\work\xampp\php\PEAR') in d:/libs/cake\libs\model\connection_manager.php on line 23
Fatal error: ConnectionManager::getDataSource - Non-existent data source default in d:/libs/cake\libs\model\connection_manager.php on line 102
Reason is that it is trying to find database.php under 'd:/servers/htdocs/myapp/config/' and the correct path is 'd:/servers/htdocs/myapp/app/config/database.php'
What am I doing wrong here?
thanks
My app is setup under d:/servers/htdocs/myapp
No, the application directory (holding the config folder) is D:\servers\htdocs\myapp\app\.
Reason is that it is trying to find database.php under 'd:/servers/htdocs/myapp/config/' and the correct path is 'd:/servers/htdocs/myapp/app/config/database.php'
You are in the wrong directory, therefore it can't find your database config.
I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells
Move your shell out of the global vendors folder at D:\servers\htdocs\myapp\vendors\shells to the application's vendors folder at D:\servers\htdocs\myapp\app\vendors\shells instead and try again.
(Note: I'm not actually sure where the global vendors folder should be when you have a setup where the cake and application directories are split from each other, but you definitely have to be in your application directory when running commands and not the myapp directory you're using.)
If you add D:\libs\cake\console\ to your PATH environment variable (remembering to close all cmd.exe processes afterwards) then you will simply be able to execute the following:
D:\servers\htdocs\myapp\app> cake report (from within the application directory)
Otherwise you will need to type the full relative or absolute path to the cake console executable and/or provide CakePHP with the absolute path to the application directory (if you are not in it):
D:\servers\htdocs\myapp\app> ..\..\..\..\libs\cake\console\cake report
D:\servers\htdocs\myapp\app> \libs\cake\console\cake report
D:\libs\cake\console> cake -app D:\servers\htdocs\myapp\app report
D:\> libs\cake\console\cake -app D:\servers\htdocs\myapp\app report
etc...
Hopefully you can see why just adding the correct folder to your PATH makes things a lot easier. :)
Try to run it from within the /app directory or with the -app parameter specified:
cake -app d:/servers/htdocs/myapp/app report
Thanks. Here was the issue
My shell script was under /myapp/vendor/shells which was wrong. It should have been under /myapp/app/vendor/shells. After I moved the file, it worked. Thank you
You should always be in your APP path to execute the cake console.
Your Shell File Should be in ..app/Console/Command/
If your file name is TestShell.php type command app> cake test

Resources